zoukankan      html  css  js  c++  java
  • CentOS 8.2部署RabbitMQ 3.8.3 消息队列服务器

    在CentOS 8上安装RabbitMQ服务器

    RabbitMQ是基于AMQP协议构建的开源消息代理软件。在本指南中,您将看到如何在CentOS 8上安装RabbitMQ服务器。

    什么是RabbitMQ ?


    RabbitMQ是一种开源消息代理软件(有时称为面向消息的中间件),最初实现了高级消息队列协议(AMQP),并已通过插件体系结构进行了扩展,以支持面向流文本的消息协议(STOMP)。MQ遥测传输(MQTT)和其他协议。

    RabbitMQ服务器程序是用Erlang编程语言编写的,并建立在Open Telecom Platform框架上,用于集群和故障转移。与代理交互的客户端库适用于所有主要编程语言,包括Java,Erlang和.NET Framework。(来源:维基百科

    RabbitMQ源代码可在RabbitMQ GitHub Repository上获得,并根据Mozilla Public License分发

    环境规格:


    • CPU :4C
    • 内存:8GB
    • 储存空间:50 GB
    • 作业系统:CentOS 8.2
    • 主机名:rabbitmq.lianglab.cn
    • IP地址:192.168.6.176/24

    RabbitMQ功能:


    • 可靠性
    • 灵活的路由
    • 聚类
    • 联合模型
    • 高可用队列
    • 多协议
    • 管理界面
    • 追踪
    • 插件系统
    • 大型社区
    • 商业支持

    您可以在其官方网站上找到完整的RabbitMQ功能

    第一步:更新您的Linux服务器


    使用SSH客户端与连接rabbitmq.lianglab.cn服务器为Linux的用户。

    使用dnf命令将Linux服务器中的软件包更新为最新的稳定版本。

    [root@centos8 ~]# hostnamectl set-hostname rabbitmq.lianglab.cn
    [root@rabbitmq ~]# chattr -ai /boot/grub2/grub.cfg
    [root@rabbitmq ~]#  dnf update -y
    
    -----------------------------------------省略----------------------------------------------------------
    
    (104/106): spice-server-0.14.2-1.el8_2.1.x86_64.rpm                      12 MB/s | 404 kB     00:00    
    (105/106): unbound-libs-1.7.3-11.el8_2.x86_64.rpm                        14 MB/s | 499 kB     00:00    
    (106/106): firefox-78.4.0-1.el8_2.x86_64.rpm                             50 MB/s | 105 MB     00:02    
    -----------------------------------------省略----------------------------------------------------------
    
    Installed:
      kernel-4.18.0-193.28.1.el8_2.x86_64                  kernel-core-4.18.0-193.28.1.el8_2.x86_64         
      kernel-modules-4.18.0-193.28.1.el8_2.x86_64         
    
    Complete!
    [root@rabbitmq ~]# 
    

    在此处检查Linux操作系统和使用中的虚拟机的内核版本。

    [root@rabbitmq ~]# cat /etc/redhat-release 
    CentOS Linux release 8.2.2004 (Core) 
    [root@rabbitmq ~]# uname -a 
    Linux rabbitmq.lianglab.cn 4.18.0-193.el8.x86_64 #1 SMP Fri May 8 10:59:10 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
    [root@rabbitmq ~]# reboot 
    

    第二步:Linux服务器上安装EPEL Yum存储库


    RabbitMQ服务器所需的某些软件包可在EPEL(企业Linux的额外软件包) yum存储库中获得。

    因此,在安装RabbitMQ之前,您需要在Linux服务器上启用/安装EPEL yum存储库。

    [root@rabbitmq yum.repos.d]# dnf install -y epel-release
    CentOS-8 - Base - mirrors.tongdun.cn                                    3.8 MB/s | 3.9 kB     00:00    
    CentOS-8 - Extras - mirrors.tongdun.cn                                  1.5 MB/s | 1.5 kB     00:00    
    CentOS-8 - AppStream - mirrors.tongdun.cn                               4.0 MB/s | 4.3 kB     00:00    
    Dependencies resolved.
    ========================================================================================================
     Package                     Architecture          Version                  Repository             Size
    ========================================================================================================
    Installing:
     epel-release                noarch                8-8.el8                  extras                 23 k
    
    Transaction Summary
    ========================================================================================================
    Install  1 Package
    
    Total download size: 23 k
    Installed size: 32 k
    Downloading Packages:
    epel-release-8-8.el8.noarch.rpm                                         1.6 MB/s |  23 kB     00:00    
    --------------------------------------------------------------------------------------------------------
    Total                                                                   1.5 MB/s |  23 kB     00:00     
    Running transaction check
    Transaction check succeeded.
    Running transaction test
    Transaction test succeeded.
    Running transaction
      Preparing        :                                                                                1/1 
      Installing       : epel-release-8-8.el8.noarch                                                    1/1 
      Running scriptlet: epel-release-8-8.el8.noarch                                                    1/1 
      Verifying        : epel-release-8-8.el8.noarch                                                    1/1 
    Installed products updated.
    
    Installed:
      epel-release-8-8.el8.noarch                                                                           
    
    Complete!
    

    第三步:Linux服务器上安装RabbitMQ官方Yum存储库


    要安装最新版本的RabbitMQ服务器,您可以编译首选Linux发行版的源代码

    也可以添加RabbitMQ官方yum存储库以从预编译的RPM软件包中安装RabbitMQ软件。

    执行以下命令以在Linux服务器上安装RabbitMQ yum存储库。

    [root@rabbitmq tmp]# dnf -y install centos-release-rabbitmq-38
    Last metadata expiration check: 0:03:30 ago on Mon 28 Dec 2020 10:56:30 PM CST.
    Dependencies resolved.
    ========================================================================================================================================================================================
     Package                                                    Architecture                           Version                                 Repository                              Size
    ========================================================================================================================================================================================
    Installing:
     centos-release-rabbitmq-38                                 noarch                                 1-2.el8                                 extras                                 8.3 k
    Installing dependencies:
     centos-release-messaging                                   noarch                                 1-2.el8                                 extras                                 9.4 k
    
    Transaction Summary
    ========================================================================================================================================================================================
    Install  2 Packages
    
    Total download size: 18 k
    Installed size: 2.7 k
    Downloading Packages:
    (1/2): centos-release-messaging-1-2.el8.noarch.rpm                                                                                                      602 kB/s | 9.4 kB     00:00    
    (2/2): centos-release-rabbitmq-38-1-2.el8.noarch.rpm                                                                                                    526 kB/s | 8.3 kB     00:00    
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Total                                                                                                                                                   1.0 MB/s |  18 kB     00:00     
    Running transaction check
    Transaction check succeeded.
    Running transaction test
    Transaction test succeeded.
    Running transaction
      Preparing        :                                                                                                                                                                1/1 
      Installing       : centos-release-messaging-1-2.el8.noarch                                                                                                                        1/2 
      Installing       : centos-release-rabbitmq-38-1-2.el8.noarch                                                                                                                      2/2 
      Verifying        : centos-release-messaging-1-2.el8.noarch                                                                                                                        1/2 
      Verifying        : centos-release-rabbitmq-38-1-2.el8.noarch                                                                                                                      2/2 
    Installed products updated.
    
    Installed:
      centos-release-messaging-1-2.el8.noarch                                                   centos-release-rabbitmq-38-1-2.el8.noarch                                                  
    
    Complete!
    
    [root@rabbitmq yum.repos.d]# ll /etc/yum.repos.d/CentOS-Messaging-rabbitmq.repo 
    -rw-r--r--. 1 root root 957 Apr 14  2020 /etc/yum.repos.d/CentOS-Messaging-rabbitmq.repo
    [root@rabbitmq tmp]# cd /etc/yum.repos.d/
    [root@rabbitmq yum.repos.d]# ls
    CentOS-Base.repo  CentOS-Messaging-rabbitmq.repo  epel.repo
    

    为新安装的yum存储库构建缓存。

    [root@rabbitmq yum.repos.d]# dnf makecache
    CentOS-8 - Base - mirrors.tongdun.cn                                    1.6 MB/s | 3.9 kB     00:00    
    CentOS-8 - Extras - mirrors.tongdun.cn                                  898 kB/s | 1.5 kB     00:00    
    CentOS-8 - AppStream - mirrors.tongdun.cn                               2.1 MB/s | 4.3 kB     00:00    
    CentOS-8 - RabbitMQ 38                                                  677  B/s | 3.0 kB     00:04    
    Extra Packages for Enterprise Linux 8 - x86_64                          2.2 MB/s | 4.7 kB     00:00    
    Extra Packages for Enterprise Linux 8 - x86_64 - Debug                  1.6 MB/s | 3.0 kB     00:00    
    Extra Packages for Enterprise Linux 8 - x86_64 - Source                 2.0 MB/s | 3.5 kB     00:00    
    Metadata cache created.
    
    

    第四步:CentOS 8上安装RabbitMQ服务器


    现在,您可以使用dnf命令轻松安装RabbitMQ服务器。因为您已经在Linux服务器上设置了EPEL yum存储库,所以将自动解决所有依赖性。

    [root@rabbitmq yum.repos.d]# ls
    CentOS-Base.repo  CentOS-Messaging-rabbitmq.repo  epel.repo
    [root@rabbitmq yum.repos.d]# dnf install -y rabbitmq-server
    Last metadata expiration check: 0:00:21 ago on Mon 28 Dec 2020 11:06:54 PM CST.
    Dependencies resolved.
    ========================================================================================================
     Package                       Architecture    Version                Repository                   Size
    ========================================================================================================
    Installing:
     rabbitmq-server               x86_64          3.8.3-1.el8            centos-rabbitmq-38           11 M
    Installing dependencies:
     SDL                           x86_64          1.2.15-37.el8          AppStream                   217 k
     erlang-asn1                   x86_64          22.2.8-1.el8           centos-rabbitmq-38          745 k
     erlang-common_test            x86_64          22.2.8-1.el8           centos-rabbitmq-38          1.0 M
     erlang-compiler               x86_64          22.2.8-1.el8           centos-rabbitmq-38          1.4 M
     erlang-crypto                 x86_64          22.2.8-1.el8           centos-rabbitmq-38          169 k
     erlang-cuttlefish             noarch          2.0.11-10.el8          centos-rabbitmq-38          154 k
     erlang-debugger               x86_64          22.2.8-1.el8           centos-rabbitmq-38          406 k
     erlang-eldap                  x86_64          22.2.8-1.el8           centos-rabbitmq-38          125 k
     erlang-erts                   x86_64          22.2.8-1.el8           centos-rabbitmq-38          2.2 M
     erlang-et                     x86_64          22.2.8-1.el8           centos-rabbitmq-38          170 k
     erlang-eunit                  x86_64          22.2.8-1.el8           centos-rabbitmq-38          165 k
     erlang-getopt                 noarch          1.0.1-8.el8            centos-rabbitmq-38           42 k
     erlang-goldrush               noarch          0.2.0-6.el8            centos-rabbitmq-38           69 k
     erlang-hipe                   x86_64          22.2.8-1.el8           centos-rabbitmq-38          2.8 M
     erlang-inets                  x86_64          22.2.8-1.el8           centos-rabbitmq-38          616 k
     erlang-kernel                 x86_64          22.2.8-1.el8           centos-rabbitmq-38          1.2 M
     erlang-lager                  noarch          3.8.0-2.el8            centos-rabbitmq-38          232 k
     erlang-mnesia                 x86_64          22.2.8-1.el8           centos-rabbitmq-38          749 k
     erlang-mustache               noarch          0.1.1-14.el8           centos-rabbitmq-38           27 k
     erlang-observer               x86_64          22.2.8-1.el8           centos-rabbitmq-38          882 k
     erlang-os_mon                 x86_64          22.2.8-1.el8           centos-rabbitmq-38          108 k
     erlang-public_key             x86_64          22.2.8-1.el8           centos-rabbitmq-38          619 k
     erlang-runtime_tools          x86_64          22.2.8-1.el8           centos-rabbitmq-38          211 k
     erlang-sasl                   x86_64          22.2.8-1.el8           centos-rabbitmq-38          269 k
     erlang-sd_notify              x86_64          1.0-14.1.el8           centos-rabbitmq-38           17 k
     erlang-snmp                   x86_64          22.2.8-1.el8           centos-rabbitmq-38          1.6 M
     erlang-ssh                    x86_64          22.2.8-1.el8           centos-rabbitmq-38          677 k
     erlang-ssl                    x86_64          22.2.8-1.el8           centos-rabbitmq-38          1.1 M
     erlang-stdlib                 x86_64          22.2.8-1.el8           centos-rabbitmq-38          2.7 M
     erlang-syntax_tools           x86_64          22.2.8-1.el8           centos-rabbitmq-38          372 k
     erlang-tools                  x86_64          22.2.8-1.el8           centos-rabbitmq-38          598 k
     erlang-wx                     x86_64          22.2.8-1.el8           centos-rabbitmq-38          2.9 M
     erlang-xmerl                  x86_64          22.2.8-1.el8           centos-rabbitmq-38          1.1 M
     lksctp-tools                  x86_64          1.0.18-3.el8           base                        100 k
     mesa-libGLU                   x86_64          9.0.0-15.el8           AppStream                   185 k
     wxBase3                       x86_64          3.0.4-11.el8           epel                        1.1 M
     wxGTK3                        x86_64          3.0.4-11.el8           epel                        4.8 M
     wxGTK3-gl                     x86_64          3.0.4-11.el8           epel                         45 k
     wxGTK3-i18n                   noarch          3.0.4-11.el8           epel                        510 k
    
    Transaction Summary
    ========================================================================================================
    Install  40 Packages
    
    Total download size: 44 M
    Installed size: 87 M
    Downloading Packages:
    (1/40): lksctp-tools-1.0.18-3.el8.x86_64.rpm                             17 MB/s | 100 kB     00:00    
    (2/40): SDL-1.2.15-37.el8.x86_64.rpm                                    9.9 MB/s | 217 kB     00:00    
    (3/40): mesa-libGLU-9.0.0-15.el8.x86_64.rpm                             6.3 MB/s | 185 kB     00:00    
    (4/40): erlang-asn1-22.2.8-1.el8.x86_64.rpm                             3.0 MB/s | 745 kB     00:00    
    (5/40): erlang-crypto-22.2.8-1.el8.x86_64.rpm                           3.7 MB/s | 169 kB     00:00    
    (6/40): erlang-cuttlefish-2.0.11-10.el8.noarch.rpm                      3.5 MB/s | 154 kB     00:00    
    (7/40): erlang-common_test-22.2.8-1.el8.x86_64.rpm                      3.1 MB/s | 1.0 MB     00:00    
    (8/40): erlang-compiler-22.2.8-1.el8.x86_64.rpm                         4.0 MB/s | 1.4 MB     00:00    
    (9/40): erlang-debugger-22.2.8-1.el8.x86_64.rpm                         7.5 MB/s | 406 kB     00:00    
    (10/40): erlang-eldap-22.2.8-1.el8.x86_64.rpm                           2.9 MB/s | 125 kB     00:00    
    (11/40): erlang-et-22.2.8-1.el8.x86_64.rpm                              3.8 MB/s | 170 kB     00:00    
    (12/40): erlang-eunit-22.2.8-1.el8.x86_64.rpm                           3.8 MB/s | 165 kB     00:00    
    (13/40): erlang-erts-22.2.8-1.el8.x86_64.rpm                             20 MB/s | 2.2 MB     00:00    
    (14/40): erlang-getopt-1.0.1-8.el8.noarch.rpm                           926 kB/s |  42 kB     00:00    
    (15/40): erlang-goldrush-0.2.0-6.el8.noarch.rpm                         1.6 MB/s |  69 kB     00:00    
    (16/40): erlang-inets-22.2.8-1.el8.x86_64.rpm                           6.7 MB/s | 616 kB     00:00    
    (17/40): erlang-kernel-22.2.8-1.el8.x86_64.rpm                           12 MB/s | 1.2 MB     00:00    
    (18/40): erlang-hipe-22.2.8-1.el8.x86_64.rpm                             19 MB/s | 2.8 MB     00:00    
    (19/40): erlang-lager-3.8.0-2.el8.noarch.rpm                            4.0 MB/s | 232 kB     00:00    
    (20/40): erlang-mnesia-22.2.8-1.el8.x86_64.rpm                           14 MB/s | 749 kB     00:00    
    (21/40): erlang-mustache-0.1.1-14.el8.noarch.rpm                        652 kB/s |  27 kB     00:00    
    (22/40): erlang-os_mon-22.2.8-1.el8.x86_64.rpm                          708 kB/s | 108 kB     00:00    
    (23/40): erlang-observer-22.2.8-1.el8.x86_64.rpm                        4.6 MB/s | 882 kB     00:00    
    (24/40): erlang-runtime_tools-22.2.8-1.el8.x86_64.rpm                   4.9 MB/s | 211 kB     00:00    
    (25/40): erlang-public_key-22.2.8-1.el8.x86_64.rpm                      3.5 MB/s | 619 kB     00:00    
    (26/40): erlang-sasl-22.2.8-1.el8.x86_64.rpm                            6.2 MB/s | 269 kB     00:00    
    (27/40): erlang-sd_notify-1.0-14.1.el8.x86_64.rpm                       417 kB/s |  17 kB     00:00    
    (28/40): erlang-ssh-22.2.8-1.el8.x86_64.rpm                             3.3 MB/s | 677 kB     00:00    
    (29/40): erlang-snmp-22.2.8-1.el8.x86_64.rpm                            6.5 MB/s | 1.6 MB     00:00    
    (30/40): erlang-stdlib-22.2.8-1.el8.x86_64.rpm                          8.2 MB/s | 2.7 MB     00:00    
    (31/40): erlang-ssl-22.2.8-1.el8.x86_64.rpm                             2.1 MB/s | 1.1 MB     00:00    
    (32/40): erlang-syntax_tools-22.2.8-1.el8.x86_64.rpm                    994 kB/s | 372 kB     00:00    
    (33/40): erlang-tools-22.2.8-1.el8.x86_64.rpm                           5.4 MB/s | 598 kB     00:00    
    (34/40): erlang-wx-22.2.8-1.el8.x86_64.rpm                              5.5 MB/s | 2.9 MB     00:00    
    (35/40): erlang-xmerl-22.2.8-1.el8.x86_64.rpm                           2.3 MB/s | 1.1 MB     00:00    
    (36/40): wxBase3-3.0.4-11.el8.x86_64.rpm                                 26 MB/s | 1.1 MB     00:00    
    (37/40): wxGTK3-gl-3.0.4-11.el8.x86_64.rpm                              5.9 MB/s |  45 kB     00:00    
    (38/40): wxGTK3-i18n-3.0.4-11.el8.noarch.rpm                             19 MB/s | 510 kB     00:00    
    (39/40): wxGTK3-3.0.4-11.el8.x86_64.rpm                                  38 MB/s | 4.8 MB     00:00    
    (40/40): rabbitmq-server-3.8.3-1.el8.x86_64.rpm                         8.3 MB/s |  11 MB     00:01    
    --------------------------------------------------------------------------------------------------------
    Total                                                                   9.9 MB/s |  44 MB     00:04     
    warning: /var/cache/dnf/centos-rabbitmq-38-fc01413bca87d629/packages/erlang-asn1-22.2.8-1.el8.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID e16e0d12: NOKEY
    CentOS-8 - RabbitMQ 38                                                  1.7 MB/s | 1.8 kB     00:00    
    Importing GPG key 0xE16E0D12:
     Userid     : "CentOS Messaging SIG (https://wiki.centos.org/SpecialInterestGroup/Messaging) <security@centos.org>"
     Fingerprint: A926 5AE9 1718 68B8 2F91 5550 8301 4EBB E16E 0D12
     From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Messaging
    Key imported successfully
    Running transaction check
    Transaction check succeeded.
    Running transaction test
    Transaction test succeeded.
    Running transaction
      Preparing        :                                                                                1/1 
      Installing       : wxBase3-3.0.4-11.el8.x86_64                                                   1/40 
      Installing       : wxGTK3-i18n-3.0.4-11.el8.noarch                                               2/40 
      Installing       : mesa-libGLU-9.0.0-15.el8.x86_64                                               3/40 
      Installing       : SDL-1.2.15-37.el8.x86_64                                                      4/40 
      Running scriptlet: SDL-1.2.15-37.el8.x86_64                                                      4/40 
      Installing       : wxGTK3-3.0.4-11.el8.x86_64                                                    5/40 
      Installing       : wxGTK3-gl-3.0.4-11.el8.x86_64                                                 6/40 
      Installing       : lksctp-tools-1.0.18-3.el8.x86_64                                              7/40 
      Running scriptlet: lksctp-tools-1.0.18-3.el8.x86_64                                              7/40 
      Installing       : erlang-crypto-22.2.8-1.el8.x86_64                                             8/40 
      Installing       : erlang-kernel-22.2.8-1.el8.x86_64                                             9/40 
      Installing       : erlang-stdlib-22.2.8-1.el8.x86_64                                            10/40 
      Running scriptlet: erlang-erts-22.2.8-1.el8.x86_64                                              11/40 
      Installing       : erlang-erts-22.2.8-1.el8.x86_64                                              11/40 
      Installing       : erlang-compiler-22.2.8-1.el8.x86_64                                          12/40 
      Installing       : erlang-syntax_tools-22.2.8-1.el8.x86_64                                      13/40 
      Installing       : erlang-hipe-22.2.8-1.el8.x86_64                                              14/40 
      Installing       : erlang-mnesia-22.2.8-1.el8.x86_64                                            15/40 
      Installing       : erlang-runtime_tools-22.2.8-1.el8.x86_64                                     16/40 
      Installing       : erlang-wx-22.2.8-1.el8.x86_64                                                17/40 
      Installing       : erlang-snmp-22.2.8-1.el8.x86_64                                              18/40 
      Installing       : erlang-asn1-22.2.8-1.el8.x86_64                                              19/40 
      Installing       : erlang-public_key-22.2.8-1.el8.x86_64                                        20/40 
      Installing       : erlang-inets-22.2.8-1.el8.x86_64                                             21/40 
      Installing       : erlang-ssl-22.2.8-1.el8.x86_64                                               22/40 
      Installing       : erlang-tools-22.2.8-1.el8.x86_64                                             23/40 
      Installing       : erlang-sasl-22.2.8-1.el8.x86_64                                              24/40 
      Installing       : erlang-xmerl-22.2.8-1.el8.x86_64                                             25/40 
      Installing       : erlang-os_mon-22.2.8-1.el8.x86_64                                            26/40 
      Installing       : erlang-eldap-22.2.8-1.el8.x86_64                                             27/40 
      Installing       : erlang-ssh-22.2.8-1.el8.x86_64                                               28/40 
      Installing       : erlang-debugger-22.2.8-1.el8.x86_64                                          29/40 
      Installing       : erlang-et-22.2.8-1.el8.x86_64                                                30/40 
      Installing       : erlang-observer-22.2.8-1.el8.x86_64                                          31/40 
      Installing       : erlang-common_test-22.2.8-1.el8.x86_64                                       32/40 
      Installing       : erlang-goldrush-0.2.0-6.el8.noarch                                           33/40 
      Installing       : erlang-lager-3.8.0-2.el8.noarch                                              34/40 
      Installing       : erlang-eunit-22.2.8-1.el8.x86_64                                             35/40 
      Installing       : erlang-getopt-1.0.1-8.el8.noarch                                             36/40 
      Installing       : erlang-mustache-0.1.1-14.el8.noarch                                          37/40 
      Installing       : erlang-cuttlefish-2.0.11-10.el8.noarch                                       38/40 
      Installing       : erlang-sd_notify-1.0-14.1.el8.x86_64                                         39/40 
      Running scriptlet: rabbitmq-server-3.8.3-1.el8.x86_64                                           40/40 
      Installing       : rabbitmq-server-3.8.3-1.el8.x86_64                                           40/40 
      Running scriptlet: rabbitmq-server-3.8.3-1.el8.x86_64                                           40/40 
      Verifying        : lksctp-tools-1.0.18-3.el8.x86_64                                              1/40 
      Verifying        : SDL-1.2.15-37.el8.x86_64                                                      2/40 
      Verifying        : mesa-libGLU-9.0.0-15.el8.x86_64                                               3/40 
      Verifying        : erlang-asn1-22.2.8-1.el8.x86_64                                               4/40 
      Verifying        : erlang-common_test-22.2.8-1.el8.x86_64                                        5/40 
      Verifying        : erlang-compiler-22.2.8-1.el8.x86_64                                           6/40 
      Verifying        : erlang-crypto-22.2.8-1.el8.x86_64                                             7/40 
      Verifying        : erlang-cuttlefish-2.0.11-10.el8.noarch                                        8/40 
      Verifying        : erlang-debugger-22.2.8-1.el8.x86_64                                           9/40 
      Verifying        : erlang-eldap-22.2.8-1.el8.x86_64                                             10/40 
      Verifying        : erlang-erts-22.2.8-1.el8.x86_64                                              11/40 
      Verifying        : erlang-et-22.2.8-1.el8.x86_64                                                12/40 
      Verifying        : erlang-eunit-22.2.8-1.el8.x86_64                                             13/40 
      Verifying        : erlang-getopt-1.0.1-8.el8.noarch                                             14/40 
      Verifying        : erlang-goldrush-0.2.0-6.el8.noarch                                           15/40 
      Verifying        : erlang-hipe-22.2.8-1.el8.x86_64                                              16/40 
      Verifying        : erlang-inets-22.2.8-1.el8.x86_64                                             17/40 
      Verifying        : erlang-kernel-22.2.8-1.el8.x86_64                                            18/40 
      Verifying        : erlang-lager-3.8.0-2.el8.noarch                                              19/40 
      Verifying        : erlang-mnesia-22.2.8-1.el8.x86_64                                            20/40 
      Verifying        : erlang-mustache-0.1.1-14.el8.noarch                                          21/40 
      Verifying        : erlang-observer-22.2.8-1.el8.x86_64                                          22/40 
      Verifying        : erlang-os_mon-22.2.8-1.el8.x86_64                                            23/40 
      Verifying        : erlang-public_key-22.2.8-1.el8.x86_64                                        24/40 
      Verifying        : erlang-runtime_tools-22.2.8-1.el8.x86_64                                     25/40 
      Verifying        : erlang-sasl-22.2.8-1.el8.x86_64                                              26/40 
      Verifying        : erlang-sd_notify-1.0-14.1.el8.x86_64                                         27/40 
      Verifying        : erlang-snmp-22.2.8-1.el8.x86_64                                              28/40 
      Verifying        : erlang-ssh-22.2.8-1.el8.x86_64                                               29/40 
      Verifying        : erlang-ssl-22.2.8-1.el8.x86_64                                               30/40 
      Verifying        : erlang-stdlib-22.2.8-1.el8.x86_64                                            31/40 
      Verifying        : erlang-syntax_tools-22.2.8-1.el8.x86_64                                      32/40 
      Verifying        : erlang-tools-22.2.8-1.el8.x86_64                                             33/40 
      Verifying        : erlang-wx-22.2.8-1.el8.x86_64                                                34/40 
      Verifying        : erlang-xmerl-22.2.8-1.el8.x86_64                                             35/40 
      Verifying        : rabbitmq-server-3.8.3-1.el8.x86_64                                           36/40 
      Verifying        : wxBase3-3.0.4-11.el8.x86_64                                                  37/40 
      Verifying        : wxGTK3-3.0.4-11.el8.x86_64                                                   38/40 
      Verifying        : wxGTK3-gl-3.0.4-11.el8.x86_64                                                39/40 
      Verifying        : wxGTK3-i18n-3.0.4-11.el8.noarch                                              40/40 
    Installed products updated.
    
    Installed:
      SDL-1.2.15-37.el8.x86_64                            erlang-asn1-22.2.8-1.el8.x86_64                   
      erlang-common_test-22.2.8-1.el8.x86_64              erlang-compiler-22.2.8-1.el8.x86_64               
      erlang-crypto-22.2.8-1.el8.x86_64                   erlang-cuttlefish-2.0.11-10.el8.noarch            
      erlang-debugger-22.2.8-1.el8.x86_64                 erlang-eldap-22.2.8-1.el8.x86_64                  
      erlang-erts-22.2.8-1.el8.x86_64                     erlang-et-22.2.8-1.el8.x86_64                     
      erlang-eunit-22.2.8-1.el8.x86_64                    erlang-getopt-1.0.1-8.el8.noarch                  
      erlang-goldrush-0.2.0-6.el8.noarch                  erlang-hipe-22.2.8-1.el8.x86_64                   
      erlang-inets-22.2.8-1.el8.x86_64                    erlang-kernel-22.2.8-1.el8.x86_64                 
      erlang-lager-3.8.0-2.el8.noarch                     erlang-mnesia-22.2.8-1.el8.x86_64                 
      erlang-mustache-0.1.1-14.el8.noarch                 erlang-observer-22.2.8-1.el8.x86_64               
      erlang-os_mon-22.2.8-1.el8.x86_64                   erlang-public_key-22.2.8-1.el8.x86_64             
      erlang-runtime_tools-22.2.8-1.el8.x86_64            erlang-sasl-22.2.8-1.el8.x86_64                   
      erlang-sd_notify-1.0-14.1.el8.x86_64                erlang-snmp-22.2.8-1.el8.x86_64                   
      erlang-ssh-22.2.8-1.el8.x86_64                      erlang-ssl-22.2.8-1.el8.x86_64                    
      erlang-stdlib-22.2.8-1.el8.x86_64                   erlang-syntax_tools-22.2.8-1.el8.x86_64           
      erlang-tools-22.2.8-1.el8.x86_64                    erlang-wx-22.2.8-1.el8.x86_64                     
      erlang-xmerl-22.2.8-1.el8.x86_64                    lksctp-tools-1.0.18-3.el8.x86_64                  
      mesa-libGLU-9.0.0-15.el8.x86_64                     rabbitmq-server-3.8.3-1.el8.x86_64                
      wxBase3-3.0.4-11.el8.x86_64                         wxGTK3-3.0.4-11.el8.x86_64                        
      wxGTK3-gl-3.0.4-11.el8.x86_64                       wxGTK3-i18n-3.0.4-11.el8.noarch                   
    
    Complete!
    
    

    【1】启用并启动RabbitMQ服务,如下所示。

    [root@rabbitmq ~]# systemctl enable --now rabbitmq-server.service
    Created symlink /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service → /usr/lib/systemd/system/rabbitmq-server.service.
    

    【2】查看RabbitMQ服务的状态

    [root@rabbitmq ~]# systemctl status rabbitmq-server.service
    ● rabbitmq-server.service - RabbitMQ broker
       Loaded: loaded (/usr/lib/systemd/system/rabbitmq-server.service; enabled; vendor preset: disabled)
       Active: active (running) since Mon 2020-12-28 23:08:35 CST; 15s ago
     Main PID: 8144 (beam.smp)
       Status: "Initialized"
        Tasks: 91 (limit: 49641)
       Memory: 81.7M
       CGroup: /system.slice/rabbitmq-server.service
               ├─8144 /usr/lib64/erlang/erts-10.6.4/bin/beam.smp -W w -A 64 -MBas ageffcbf -MHas ageffcbf ->
               ├─8246 /usr/lib64/erlang/erts-10.6.4/bin/epmd -daemon
               ├─8393 erl_child_setup 1024
               ├─8449 inet_gethost 4
               └─8450 inet_gethost 4
    
    Dec 28 23:08:35 rabbitmq.lianglab.cn rabbitmq-server[8144]:   ##########  Licensed under the MPL 1.1. W>
    Dec 28 23:08:35 rabbitmq.lianglab.cn rabbitmq-server[8144]:   Doc guides: https://rabbitmq.com/document>
    Dec 28 23:08:35 rabbitmq.lianglab.cn rabbitmq-server[8144]:   Support:    https://rabbitmq.com/contact.>
    Dec 28 23:08:35 rabbitmq.lianglab.cn rabbitmq-server[8144]:   Tutorials:  https://rabbitmq.com/getstart>
    Dec 28 23:08:35 rabbitmq.lianglab.cn rabbitmq-server[8144]:   Monitoring: https://rabbitmq.com/monitori>
    Dec 28 23:08:35 rabbitmq.lianglab.cn rabbitmq-server[8144]:   Logs: /var/log/rabbitmq/rabbit@rabbitmq.l>
    Dec 28 23:08:35 rabbitmq.lianglab.cn rabbitmq-server[8144]:         /var/log/rabbitmq/rabbit@rabbitmq_u>
    Dec 28 23:08:35 rabbitmq.lianglab.cn rabbitmq-server[8144]:   Config file(s): /etc/rabbitmq/rabbitmq.co>
    Dec 28 23:08:35 rabbitmq.lianglab.cn systemd[1]: Started RabbitMQ broker.
    

    第五步:CentOS 8上安装RabbitMQ管理界面


    尽管RabbitMQ软件包已经包含CLI(命令行)工具来管理RabbitMQ服务器。

    但是,您也可以选择安装RabbitMQ管理UI来执行基于GUI的管理。

    【1】执行以下命令在Linux服务器上安装RabbitMQ管理UI。

    [root@rabbitmq ~]# rabbitmq-plugins enable rabbitmq_management
    Enabling plugins on node rabbit@rabbitmq:
    rabbitmq_management
    The following plugins have been configured:
      rabbitmq_management
      rabbitmq_management_agent
      rabbitmq_web_dispatch
    Applying plugin configuration to rabbit@rabbitmq...
    The following plugins have been enabled:
      rabbitmq_management
      rabbitmq_management_agent
      rabbitmq_web_dispatch
    
    started 3 plugins.
    

    【2】验证RabbitMQ管理UI服务是否正在默认端口15672上运行。

    [root@rabbitmq-01 ~]# ss -tulpn | grep 15672
    tcp     LISTEN   0        128              0.0.0.0:15672          0.0.0.0:*      users:(("beam.smp",pid=2949,fd=98))
    

    为了允许进入RabbitMQ管理UI的传入流量,您需要在Linux防火墙中允许默认服务端口15672/tcp

    此外,RabbitMQ将端口5672/tcp用于基于AMQP协议的队列。因此,您还应该在Linux防火墙中启用它。

    【3】执行以下命令以允许Linux防火墙放行端口。

    [root@rabbitmq ~]# firewall-cmd --add-port=15672/tcp --permanent
    success
    [root@rabbitmq ~]# firewall-cmd --add-port=5672/tcp --permanent
    success
    [root@rabbitmq ~]# firewall-cmd --reload
    success
    

    第六步:RabbitMQ管理员用户与运维管理


    RabbitMQ默认用户guest和密码guest。该来宾用户具有管理特权,但只能从本地主机登录到RabbitMQ服务器。

    因此,我们需要创建另一个管理员用户以远程访问RabbitMQ管理UI。

    【1】检查RabbitMQ服务器上已经可用的用户。

    [root@rabbitmq ~]# rabbitmqctl list_users
    Listing users ...
    user	tags
    guest	[administrator]
    

    【2】在Linux命令行上执行以下命令以创建一个用于管理RabbitMQ服务器的新用户。

    # rabbitmqctl add_user [user] [password]
    
    [root@rabbitmq ~]# rabbitmqctl add_user admin lianglab@passwd
    Adding user "admin" ...
    
    # 显示用户列表
    [root@rabbitmq ~]# rabbitmqctl list_users
    Listing users ...
    user	tags
    admin	[]
    guest	[administrator] 
    
    #修改用户名密码
    [root@rabbitmq ~]# rabbitmqctl change_password admin lianglab@newpasswd
    Changing password for user "admin" ...
    
    
    #将管理角色授予用户如下所示
    [root@rabbitmq ~]# rabbitmqctl set_user_tags admin administrator
    Setting tags for user "admin" to [administrator] ...
    
    
    #删除用户如下所示
    [root@rabbitmq ~]# rabbitmqctl delete_user admin
    Deleting user "admin" ...
    
    
    
    

    【3】要使用RabbitMQ,也要添加Virtualhost。

    #rabbitmqctl add_vhost [vhost]
    
    #创建虚拟机主机
    [root@rabbitmq ~]# rabbitmqctl add_vhost /lianglab_vhost
    Adding vhost "/lianglab_vhost" ...
    
    
    #显示虚拟主机列表
    [root@rabbitmq ~]# rabbitmqctl list_vhosts
    Listing vhosts ...
    name
    /lianglab_vhost
    /
    
    
    #删除虚拟主机如下
    [root@rabbitmq ~]# rabbitmqctl delete_vhost /lianglab_vhost
    Deleting vhost "/lianglab_vhost" ...
    [root@rabbitmq ~]# rabbitmqctl list_vhosts
    Listing vhosts ...
    name
    /
    
    

    【4】要向用户授予虚拟主机的权限,请进行如下配置。

    # rabbitmqctl set_permissions [-p vhost] [用户] [权限⇒(修改)(写)(读)]
    
    [root@rabbitmq ~]# rabbitmqctl set_permissions -p /lianglab_vhost admin ".*" ".*" ".*"
    Setting permissions for user "admin" in vhost "/lianglab_vhost" ...
    
    
    #显示虚拟主机的权限
    [root@rabbitmq ~]# rabbitmqctl list_permissions -p /lianglab_vhost
    Listing permissions for vhost "/lianglab_vhost" ...
    user	configure	write	read
    admin	.*	.*	.*
    
    
    #显示特定用户的权限
    [root@rabbitmq ~]# rabbitmqctl list_user_permissions admin
    Listing permissions for user "admin" ...
    vhost	configure	write	read
    /lianglab_vhost	.*	.*	.*
    [root@rabbitmq ~]# 
    
    #删除特定用户的权限如下
    rabbitmqctl clear_permissions -p /lianglab_vhost admin
    

    【5】网络浏览器中打开URL http://192.168.6.176:15672/

    以您在先前步骤中创建的管理员用户身份登录。

    成功登录后,您可以访问RabbitMQ管理UI的仪表板。您可以从此处对RabbitMQ服务器进行完全管理。

    我们强烈建议您购买和阅读Manning Publications的《RabbitMQ深度》,以增加您在该领域的知识并为您的应用程序使用RabbitMQ服务器。

  • 相关阅读:
    spark简单入门
    vim 树形目录插件NERDTree
    Windows下查看系统端口使用的命令
    网络爬虫爬取动态网页
    Java并查集链表实现
    基于mahout的海量数据关联规则挖掘
    高维特征降维方法-随机映射
    JVM(4)--垃圾回收算法
    Java高并发程序设计(六)--线程池(1)
    Java高并发程序设计(五)--ReentrantLock源码解析
  • 原文地址:https://www.cnblogs.com/lianglab/p/14204384.html
Copyright © 2011-2022 走看看