RabbitMQ安装配置文档

版本介绍:

erlang      : erlang-20.2.2-1.el7.centos.x86_64.rpm

rabbitmq : rabbitmq-server-3.7.4-1.el7.noarch.rpm

OS             : CentOS Linux release 7.7.1908 (Core)

备 注:这里的erlang版本和rabbitmq的版本有一定的范围匹配,若超出范围可能出现异常。


1.下载安装包

[root@localhost yum.repos.d]# cd /opt

[root@localhost opt]# ls

erlang-20.2.2-1.el7.centos.x86_64.rpm  rabbitmq-server-3.7.4-1.el7.noarch.rpm

2.安装erlang

[root@localhost opt]# yum install -y erlang-20.2.2-1.el7.centos.x86_64.rpm

Loaded plugins: fastestmirror

Examining erlang-20.2.2-1.el7.centos.x86_64.rpm: erlang-20.2.2-1.el7.centos.x86_64

Marking erlang-20.2.2-1.el7.centos.x86_64.rpm to be installed

Resolving Dependencies

--> Running transaction check

---> Package erlang.x86_64 0:20.2.2-1.el7.centos will be installed

--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================================

Package                  Arch                    Version                                Repository                                            Size

=====================================================================================================================================================

Installing:

erlang                  x86_64                  20.2.2-1.el7.centos                    /erlang-20.2.2-1.el7.centos.x86_64                    31 M

Transaction Summary

=====================================================================================================================================================

Install  1 Package

Total size: 31 M

Installed size: 31 M

Downloading packages:

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

  Installing : erlang-20.2.2-1.el7.centos.x86_64                                                                                                1/1

  Verifying  : erlang-20.2.2-1.el7.centos.x86_64                                                                                                1/1

Installed:

  erlang.x86_64 0:20.2.2-1.el7.centos

Complete!

[root@localhost opt]#

[root@localhost opt]# erl

Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V9.2  (abort with ^G)

1>

BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded

      (v)ersion (k)ill (D)b-tables (d)istribution

^C[root@localhost opt]#

[root@localhost opt]#

3.安装rabbitMQ

[root@localhost opt]# yum install rabbitmq-server-3.7.4-1.el7.noarch.rpm

Loaded plugins: fastestmirror

Examining rabbitmq-server-3.7.4-1.el7.noarch.rpm: rabbitmq-server-3.7.4-1.el7.noarch

Marking rabbitmq-server-3.7.4-1.el7.noarch.rpm to be installed

Resolving Dependencies

--> Running transaction check

---> Package rabbitmq-server.noarch 0:3.7.4-1.el7 will be installed

--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================================

Package                          Arch                    Version                        Repository                                            Size

=====================================================================================================================================================

Installing:

rabbitmq-server                  noarch                  3.7.4-1.el7                    /rabbitmq-server-3.7.4-1.el7.noarch                  13 M

Transaction Summary

=====================================================================================================================================================

Install  1 Package

Total size: 13 M

Installed size: 13 M

Is this ok [y/d/N]: y

Downloading packages:

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

  Installing : rabbitmq-server-3.7.4-1.el7.noarch                                                                                                1/1

  Verifying  : rabbitmq-server-3.7.4-1.el7.noarch                                                                                                1/1

Installed:

  rabbitmq-server.noarch 0:3.7.4-1.el7

Complete!

4.启动rabbitMQ

[root@localhost opt]# systemctl start rabbitmq-server

[root@localhost opt]# systemctl status rabbitmq-server

● rabbitmq-server.service - RabbitMQ broker

  Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; disabled; vendor preset: disabled)

  Active: active (running) since Sun 2020-08-30 07:45:40 CST; 6s ago

Main PID: 15463 (beam.smp)

  Status: "Initialized"

  CGroup: /system.slice/rabbitmq-server.service

          ├─15463 /usr/lib64/erlang/erts-9.2/bin/beam.smp -W w -A 64 -P 1048576 -t 5000000 -stbt db -zdbbl 1280000 -K true -- -root /usr/lib64/er...

          ├─15634 /usr/lib64/erlang/erts-9.2/bin/epmd -daemon

          ├─15778 erl_child_setup 1024

          ├─15804 inet_gethost 4

          └─15805 inet_gethost 4

Aug 30 07:45:38 localhost.localdomain rabbitmq-server[15463]: ##  ##

Aug 30 07:45:38 localhost.localdomain rabbitmq-server[15463]: ##  ##      RabbitMQ 3.7.4. Copyright (C) 2007-2018 Pivotal Software, Inc.

Aug 30 07:45:38 localhost.localdomain rabbitmq-server[15463]: ##########  Licensed under the MPL.  See http://www.rabbitmq.com/

Aug 30 07:45:38 localhost.localdomain rabbitmq-server[15463]: ######  ##

Aug 30 07:45:38 localhost.localdomain rabbitmq-server[15463]: ##########  Logs: /var/log/rabbitmq/[email protected]

Aug 30 07:45:38 localhost.localdomain rabbitmq-server[15463]: /var/log/rabbitmq/rabbit@localhost_upgrade.log

Aug 30 07:45:38 localhost.localdomain rabbitmq-server[15463]: Starting broker...

Aug 30 07:45:40 localhost.localdomain rabbitmq-server[15463]: systemd unit for activation check: "rabbitmq-server.service"

Aug 30 07:45:40 localhost.localdomain systemd[1]: Started RabbitMQ broker.

Aug 30 07:45:41 localhost.localdomain rabbitmq-server[15463]: completed with 0 plugins.

[root@localhost opt]# ps -ef | grep rabbit

rabbitmq  17274      1  2 07:51 ?        00:00:10 /usr/lib64/erlang/erts-9.2/bin/beam.smp -W w -A 64 -P 1048576 -t 5000000 -stbt db -zdbbl 1280000 -K true -- -root /usr/lib64/erlang -progname erl -- -home /var/lib/rabbitmq -- -pa /usr/lib/rabbitmq/lib/rabbitmq_server-3.7.4/ebin -noshell -noinput -s rabbit boot -sname rabbit@localhost -boot start_sasl -kernel inet_default_connect_options [{nodelay,true}] -sasl errlog_type error -sasl sasl_error_logger false -rabbit lager_log_root "/var/log/rabbitmq" -rabbit lager_default_file "/var/log/rabbitmq/[email protected]" -rabbit lager_upgrade_file "/var/log/rabbitmq/rabbit@localhost_upgrade.log" -rabbit enabled_plugins_file "/etc/rabbitmq/enabled_plugins" -rabbit plugins_dir "/usr/lib/rabbi mq/plugins:/usr/lib/rabbitmq/lib/rabbitmq_server-3.7.4/plugins" -rabbit plugins_expand_dir "/var/lib/rabbitmq/mnesia/rabbit@localhost-plugins-expand" -os_mon start_cpu_sup false -os_mon start_disksup false -os_mon start_memsup false -mnesia dir "/var/lib/rabbitmq/mnesia/rabbit@localhost" -kernel inet_dist_listen_min 25672 -kernel inet_dist_listen_max 25672

rabbitmq  17455      1  0 07:51 ?        00:00:00 /usr/lib64/erlang/erts-9.2/bin/epmd -daemon

rabbitmq  17599  17274  0 07:51 ?        00:00:00 erl_child_setup 1024

rabbitmq  17626  17599  0 07:51 ?        00:00:00 inet_gethost 4

rabbitmq  17627  17626  0 07:51 ?        00:00:00 inet_gethost 4

root      17736  1305  0 07:59 pts/0    00:00:00 grep --color=auto rabbit

[root@localhost opt]# netstat -anultp | grep 5672

tcp        0      0 0.0.0.0:25672          0.0.0.0:*              LISTEN      15463/beam.smp

tcp6      0      0 :::5672                :::*                    LISTEN      15463/beam.smp

[root@localhost opt]# systemctl stop rabbitmq-server

[root@localhost opt]# systemctl start rabbitmq-server

[root@localhost opt]# systemctl enable rabbitmq-server

[root@localhost opt]# rabbitmqctl list_users

Listing users ...

guest  [administrator]

5.添加用户及设置权限

[root@localhost opt]# rabbitmqctl add_user admin pwd

Adding user "admin" ...

[root@localhost opt]# rabbitmqctl set_user_tags admin administrator

Setting tags for user "admin" to [administrator] ...

[root@localhost opt]# rabbitmqctl  set_permissions -p "/" admin '.*' '.*' '.*'

Setting permissions for user "admin" in vhost "/" ...

[root@localhost opt]# rabbitmqctl list_user_permissions admin

Listing permissions for user "admin" ...

/      .*      .*      .*

6.配置远程访问(启动rabbitmq内置web插件, 管理rabbitmq账号等信息)

[root@localhost opt]# rabbitmq-plugins enable rabbitmq_management

The following plugins have been configured:

  rabbitmq_management

  rabbitmq_management_agent

  rabbitmq_web_dispatch

Applying plugin configuration to rabbit@localhost...

The following plugins have been enabled:

  rabbitmq_management

  rabbitmq_management_agent

  rabbitmq_web_dispatch

started 3 plugins.

[root@localhost opt]#  systemctl restart rabbitmq-server

[root@localhost opt]# netstat -anultp | grep 5672

tcp        0      0 0.0.0.0:15672          0.0.0.0:*              LISTEN      15980/beam.smp

tcp        0      0 0.0.0.0:25672          0.0.0.0:*              LISTEN      15980/beam.smp

tcp        0      0 127.0.0.1:58359        127.0.0.1:25672        TIME_WAIT  -

tcp        0      0 127.0.0.1:38632        127.0.0.1:25672        TIME_WAIT  -

tcp        0      0 127.0.0.1:37650        127.0.0.1:25672        TIME_WAIT  -

tcp        0      0 127.0.0.1:55210        127.0.0.1:25672        TIME_WAIT  -

tcp        0      0 127.0.0.1:38588        127.0.0.1:25672        TIME_WAIT  -

tcp6      0      0 :::5672                :::*                    LISTEN      15980/beam.smp

[root@localhost opt]#

7.测试访问

访问:http://192.168.43.125:15672/进行测试


下载链接:

https://github.com/rabbitmq/erlang-rpm/releases/tag/v20.2.2

https://dl.bintray.com/rabbitmq/all/rabbitmq-server/3.7.4/


参阅: 

https://segmentfault.com/a/1190000017142426

你可能感兴趣的:(RabbitMQ安装配置文档)