暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Rabbitmq安装&&版本升级

原创 郭鸿伟 云和恩墨 2023-02-03
2584


Rabbitmq安装&&版本升级


1、3.8.11版本安装

1.1 rabbitmq和erlang的对应关系


1.2 安装wxWidgets环境

由于rabbitmq是erlang语言编写的,安装rabbitmq之前,需要先安装erlang,安装erlang之前需要安装wxWidgets,安装wxWidgets之前需要安装gtk2-devel与binutils-devel

 #更新系统itmcat
 
 [root@sjz1 /]# yum update
 已安装:
  kernel.x86_64 0:3.10.0-1160.25.1.el7
 
 更新完毕:
  bind-export-libs.x86_64 32:9.11.4-26.P2.el7_9.5   device-mapper.x86_64 7:1.02.170-6.el7_9.5     device-mapper-libs.x86_64 7:1.02.170-6.el7_9.5   firewalld.noarch 0:0.6.3-13.el7_9
  firewalld-filesystem.noarch 0:0.6.3-13.el7_9     kernel-headers.x86_64 0:3.10.0-1160.25.1.el7   kernel-tools.x86_64 0:3.10.0-1160.25.1.el7       kernel-tools-libs.x86_64 0:3.10.0-1160.25.1.el7
  kexec-tools.x86_64 0:2.0.15-51.el7_9.2           nss.x86_64 0:3.53.1-7.el7_9                   nss-sysinit.x86_64 0:3.53.1-7.el7_9             nss-tools.x86_64 0:3.53.1-7.el7_9
  openldap.x86_64 0:2.4.44-23.el7_9                 python-firewall.noarch 0:0.6.3-13.el7_9       python-perf.x86_64 0:3.10.0-1160.25.1.el7
 
 完毕!
 #安装wxWidgets相关依赖,不装这个就会报以下错误
 [root@sjz1 /]# yum -y install gtk2-devel binutils-devel
 已加载插件:fastestmirror
 Loading mirror speeds from cached hostfile
 软件包 gtk2-devel-2.24.31-1.el7.x86_64 已安装并且是最新版本
 软件包 binutils-devel-2.27-44.base.el7.x86_64 已安装并且是最新版本
 无须任何处理

错误内容

 checking for GTK+ version... 
 checking for pkg-config... /usr/bin/pkg-config
 checking for GTK+ - version >= 2.6.0... no
 *** Could not run GTK+ test program, checking why...
 *** The test program failed to compile or link. See the file config.log for the
 *** exact error that occurred. This usually means GTK+ is incorrectly installed.
 checking for pkg-config... (cached) /usr/bin/pkg-config
 checking for GTK+ - version >= 3.0.0... no
 *** Could not run GTK+ test program, checking why...
 *** The test program failed to compile or link. See the file config.log for the
 *** exact error that occured. This usually means GTK+ is incorrectly installed.
 checking for gtk-config... no
 checking for GTK - version >= 1.2.7... no
 *** The gtk-config script installed by GTK could not be found
 *** If GTK was installed in PREFIX, make sure PREFIX/bin is in
 *** your path, or set the GTK_CONFIG environment variable to the
 *** full path to gtk-config.
 checking for gtk-config... (cached) no
 checking for GTK - version >= 1.2.3... no
 *** The gtk-config script installed by GTK could not be found
 *** If GTK was installed in PREFIX, make sure PREFIX/bin is in
 *** your path, or set the GTK_CONFIG environment variable to the
 *** full path to gtk-config.
 configure: error:
 The development files for GTK+ were not found. For GTK+ 2, please
 ensure that pkg-config is in the path and that gtk+-2.0.pc is
 installed. For GTK+ 1.2 please check that gtk-config is in the path,
 and that the version is 1.2.3 or above. Also check that the
 libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
 --libs' are in the LD_LIBRARY_PATH or equivalent.
  • 由于erlang依赖wxWidgets,下载wxWidgets安装包,wxWidgets版本为2.8.4或更高版本,本次安装下载最新版本3.1.3版本

 [root@sjz1 /]# wget https://github.com/wxWidgets/wxWidgets/releases/download/v3.1.3/wxWidgets-3.1.3.tar.bz2
  • 创建wxWidgets的安装路径文件夹

 [root@sjz1 /]# mkdir -p /usr/local/wxWidgets
 [root@sjz1 local]# ll
 总用量 60
 drwxr-xr-x  7 root root  4096 6月   9 15:36 aegis
 drwxr-xr-x. 2 root root  4096 4月  20 12:07 bin
 drwxr-xr-x  4 root root  4096 5月  27 14:35 erlang
 drwxr-xr-x. 2 root root  4096 4月  11 2018 etc
 drwxr-xr-x. 2 root root  4096 4月  11 2018 games
 drwxr-xr-x. 2 root root  4096 4月  11 2018 include
 drwxr-xr-x  7 10143 10143 4096 3月  12 2020 jdk
 drwxr-xr-x. 3 root root  4096 4月  20 12:07 lib
 drwxr-xr-x. 3 root root  4096 4月  20 12:07 lib64
 drwxr-xr-x. 2 root root  4096 4月  11 2018 libexec
 drwxr-xr-x  8 root root  4096 5月  27 14:39 rabbitmq
 drwxr-xr-x. 2 root root  4096 4月  11 2018 sbin
 drwxr-xr-x. 7 root root  4096 5月  27 11:59 share
 drwxr-xr-x. 2 root root  4096 4月  11 2018 src
 drwxr-xr-x  6 root root  4096 5月  27 14:27 wxWidgets
  • 解压wxWidgets

 [root@sjz1 software]# ll
 总用量 313232
 -rw-r--r-- 1 root root 195132576 5月  27 14:21 jdk-8u251-linux-x64.tar.gz
 -rw-r--r-- 1 root root  87930432 5月  27 12:44 otp_src_22.3.tar.gz
 -rw-r--r-- 1 root root  16332800 1月  22 01:55 rabbitmq-server-generic-unix-3.8.11.tar
 -rw-r--r-- 1 root root  21345268 5月  27 14:07 wxWidgets-3.1.3.tar.bz2
 [root@sjz1 software]# tar -xvf wxWidgets-3.1.3.tar.bz2
  • 进入wxWidgets目录,并编译安装

 [root@sjz1 software]# cd wxWidgets-3.1.3/
 ./configure --with-regex=builtin --with-gtk --enable-unicode --disable-shared --prefix=/usr/local/wxWidgets
 make && make install
  • 设置变量

 #准备设置其动态库
 cd /etc/ld.so.conf.d/
 
 #创建文件
 touch wxWidgets.conf
 
 #打开文件
 vim wxWidgets.conf
 
 #增加以下内容
 /usr/local/lib
 
 #重新加载动态库配置信息
 ldconfig
 
 #配置wxWidgets环境变量=
 vim /etc/profile
 
 #将以下内容存储至profile文件中,保存并退出
 export WXPATH=/usr/local/wxWidgets/
 export PATH=$WXPATH/bin:$PATH
 
 #使环境变量刷新并生效
 source /etc/profile
  • 查看wx版本号

 [root@sjz1 wxWidgets]# wx-config --version
 3.1.3

1.3 安装Java开发环境

  • 检查服务器jdk环境

 [root@sjz1 wxWidgets]# java -version
 java version "1.8.0_251"
 Java(TM) SE Runtime Environment (build 1.8.0_251-b08)
 Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode)
  • 自行安装jdk并配置环境变量

 [root@sjz1 wxWidgets]# cd /opt/software/
 [root@sjz1 software]# ll
 总用量 313232
 -rw-r--r-- 1 root root 195132576 5月  27 14:21 jdk-8u251-linux-x64.tar.gz
 -rw-r--r-- 1 root root  87930432 5月  27 12:44 otp_src_22.3.tar.gz
 -rw-r--r-- 1 root root  16332800 1月  22 01:55 rabbitmq-server-generic-unix-3.8.11.tar
 -rw-r--r-- 1 root root  21345268 5月  27 14:07 wxWidgets-3.1.3.tar.bz2
 [root@sjz1 software]# cat /etc/profile
 JAVA_HOME=/usr/local/jdk
 
 PATH=$JAVA_HOME/bin:$PATH
 
 CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
 export JAVA_HOME
 export PATH
 export CLASSPATH

1.4 安装erlang依赖&&安装erlang

  • 如果有报错,大部分为依赖问题,随时通过yum进行安装

 #安装环境依赖
 yum install -y epel-release
 yum install -y make gcc gcc-c++ m4 openssl openssl-devel ncurses-devel unixODBC unixODBC-devel java java-devel
 已加载插件:fastestmirror
 Determining fastest mirrors
 base                                                                                                                                                                           | 3.6 kB  00:00:00
 epel                                                                                                                                                                           | 4.7 kB  00:00:00
 extras                                                                                                                                                                         | 2.9 kB  00:00:00
 updates                                                                                                                                                                         | 2.9 kB  00:00:00
 (1/4): epel/x86_64/group_gz                                                                                                                                                     |  96 kB  00:00:00
 (2/4): epel/x86_64/updateinfo                                                                                                                                                   | 1.0 MB  00:00:00
 (3/4): extras/7/x86_64/primary_db                                                                                                                                               | 242 kB  00:00:00
 (4/4): epel/x86_64/primary_db                                                                                                                                                   | 6.9 MB  00:00:00
 软件包 gcc-4.8.5-44.el7.x86_64 已安装并且是最新版本
 软件包 gcc-c++-4.8.5-44.el7.x86_64 已安装并且是最新版本
 软件包 1:make-3.82-24.el7.x86_64 已安装并且是最新版本
 软件包 m4-1.4.16-10.el7.x86_64 已安装并且是最新版本
 软件包 ncurses-devel-5.9-14.20130511.el7_4.x86_64 已安装并且是最新版本
 软件包 1:openssl-1.0.2k-21.el7_9.x86_64 已安装并且是最新版本
 软件包 1:openssl-devel-1.0.2k-21.el7_9.x86_64 已安装并且是最新版本
 软件包 unixODBC-2.3.1-14.el7.x86_64 已安装并且是最新版本
 软件包 unixODBC-devel-2.3.1-14.el7.x86_64 已安装并且是最新版本
 正在解决依赖关系
 --> 正在检查事务
 ---> 软件包 kernel-devel.x86_64.0.3.10.0-1160.25.1.el7 将被 安装
 --> 解决依赖关系完成
 
 依赖关系解决
 
 =======================================================================================================================================================================================================
  Package                                         架构                                     版本                                                       源                                         大小
 =======================================================================================================================================================================================================
 正在安装:
  kernel-devel                                   x86_64                                    3.10.0-1160.25.1.el7                                       updates                                     18 M
 
 事务概要
 =======================================================================================================================================================================================================
 安装  1 软件包
 
 总下载量:18 M
 安装大小:38 M
 Downloading packages:
 Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
 kernel-devel-3.10.0-1160.25.1.el7.x86_64.rpm                                                                                                                                   |  18 MB  00:00:00
 Running transaction check
 Running transaction test
 Transaction test succeeded
 Running transaction
  正在安装   : kernel-devel-3.10.0-1160.25.1.el7.x86_64                                                                                                                                           1/1
  验证中     : kernel-devel-3.10.0-1160.25.1.el7.x86_64                                                                                                                                           1/1
 
 已安装:
  kernel-devel.x86_64 0:3.10.0-1160.25.1.el7
 
 完毕!
 
 
 #解压erlang安装包
 tar -xvf otp_src_22.3.tar.gz -C /opt
 
 #创建erlang目录
 mkdir -p /usr/local/erlang
 
 #编译
 [root@sjz1 erlang]# ./configure --prefix=/usr/local/erlang
 
 #安装
 make && make install
  • 设置环境变量

 [root@sjz1 software]# cat /etc/profile
 export ERLPATH=/usr/local/erlang
 export PATH=$ERLPATH/bin:$PATH
 
 #刷新生效
 [root@sjz1 software]# source /etc/profile
  • erlang验证

 [root@sjz1 software]# erl
 Erlang/OTP 22 [erts-10.7] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [hipe]
 
 Eshell V10.7 (abort with ^G)
 1>

1.5获取rabbitmq安装包

https://github.com/rabbitmq/rabbitmq-server/releases/tag/v3.8.11


1.6搭建Rabbitmq环境

 #对压缩包进行解压
 tar -xvf rabbitmq-server-generic-unix-3.8.11.tar.xz
 
 #此时RabbitMQ的安装位置在【/opt/rabbitmq_server-3.8.11】,添加环境变量
 vim /etc/profile
 
 #将以下内容存储至profile文件中,保存并退出,这个环境变量要是不想设置也每关系,直接去文件里运行文件即可
 PATH=$PATH:/usr/local/rabbitmq/sbin
 
 #使环境变量刷新并生效
 source /etc/profile
 
 #添加web管理插件
 rabbitmq-plugins enable rabbitmq_management
 
 [root@sjz1 software]# rabbitmq-plugins list
 Listing plugins with pattern ".*" ...
  Configured: E = explicitly enabled; e = implicitly enabled
  | Status: * = running on rabbit@sjz1
  |/
 [ ] rabbitmq_amqp1_0                  3.8.11
 [ ] rabbitmq_auth_backend_cache       3.8.11
 [ ] rabbitmq_auth_backend_http        3.8.11
 [ ] rabbitmq_auth_backend_ldap        3.8.11
 [ ] rabbitmq_auth_backend_oauth2      3.8.11
 [ ] rabbitmq_auth_mechanism_ssl       3.8.11
 [ ] rabbitmq_consistent_hash_exchange 3.8.11
 [ ] rabbitmq_event_exchange           3.8.11
 [ ] rabbitmq_federation               3.8.11
 [ ] rabbitmq_federation_management    3.8.11
 [ ] rabbitmq_jms_topic_exchange       3.8.11
 [E*] rabbitmq_management               3.8.11
 [e*] rabbitmq_management_agent         3.8.11
 [ ] rabbitmq_mqtt                     3.8.11
 [ ] rabbitmq_peer_discovery_aws       3.8.11
 [ ] rabbitmq_peer_discovery_common    3.8.11
 [ ] rabbitmq_peer_discovery_consul    3.8.11
 [ ] rabbitmq_peer_discovery_etcd      3.8.11
 [ ] rabbitmq_peer_discovery_k8s       3.8.11
 [ ] rabbitmq_prometheus               3.8.11
 [ ] rabbitmq_random_exchange          3.8.11
 [ ] rabbitmq_recent_history_exchange  3.8.11
 [ ] rabbitmq_sharding                 3.8.11
 [ ] rabbitmq_shovel                   3.8.11
 [ ] rabbitmq_shovel_management        3.8.11
 [ ] rabbitmq_stomp                    3.8.11
 [ ] rabbitmq_top                      3.8.11
 [ ] rabbitmq_tracing                  3.8.11
 [ ] rabbitmq_trust_store              3.8.11
 [e*] rabbitmq_web_dispatch             3.8.11
 [ ] rabbitmq_web_mqtt                 3.8.11
 [ ] rabbitmq_web_mqtt_examples        3.8.11
 [ ] rabbitmq_web_stomp                3.8.11
 [ ] rabbitmq_web_stomp_examples       3.8.11
  • 在/usr/local/rabbitmq/etc/rabbitmq创建配置文件(其实也不用创建,设置为默认即可,因为我们现在是单机环境搭建),rabbitMq默认是不自带配置文件的,可以去github上复制一份

 [root@sjz1 rabbitmq]# vim rabbitmq.conf
 # ======================================
 # RabbitMQ broker section
 # ======================================
 
 ## Related doc guide: https://rabbitmq.com/configure.html. See
 ## https://rabbitmq.com/documentation.html for documentation ToC.
 
 ## Networking
 ## ====================
 ##
 ## Related doc guide: https://rabbitmq.com/networking.html.
 ##
 ## By default, RabbitMQ will listen on all interfaces, using
 ## the standard (reserved) AMQP 0-9-1 and 1.0 port.
 ##
 # listeners.tcp.default = 5672
 
 ## To listen on a specific interface, provide an IP address with port.
 ## For example, to listen only on localhost for both IPv4 and IPv6:
 ##
 # IPv4
 # listeners.tcp.local   = 127.0.0.1:5672
 
  IPv6
 # listeners.tcp.local_v6 = ::1:5672
 
 ## You can define multiple listeners using listener names
 # listeners.tcp.other_port = 5673
 # listeners.tcp.other_ip   = 10.10.10.10:5672
 
 
 ## TLS listeners are configured in the same fashion as TCP listeners,
 ## including the option to control the choice of interface.
 ##
 # listeners.ssl.default = 5671
 
 ## It is possible to disable regular TCP (non-TLS) listeners. Clients
 ## not configured to use TLS and the correct TLS-enabled port won't be able
 ## to connect to this node.
 # listeners.tcp = none
 
 ## Number of Erlang processes that will accept connections for the TCP
 ## and TLS listeners.
 ##
 # num_acceptors.tcp = 10
 # num_acceptors.ssl = 10
 
 ## Socket writer will force GC every so many bytes transferred.
 ## Default is 1 GiB (`1000000000`). Set to 'off' to disable.
 ##
 # socket_writer.gc_threshold = 1000000000
 #
 ## To disable:
 # socket_writer.gc_threshold = off
 
 ## Maximum amount of time allowed for the AMQP 0-9-1 and AMQP 1.0 handshake
 ## (performed after socket connection and TLS handshake) to complete, in milliseconds.
 ##
 # handshake_timeout = 10000
 
 ## Set to 'true' to perform reverse DNS lookups when accepting a
 ## connection. rabbitmqctl and management UI will then display hostnames
 ## instead of IP addresses. Default value is `false`.
 ##
 # reverse_dns_lookups = false
 
 ##
 ## Security, Access Control
 ## ==============
 ##
 
 ## Related doc guide: https://rabbitmq.com/access-control.html.
 
 ## The default "guest" user is only permitted to access the server
 ## via a loopback interface (e.g. localhost).
 ## {loopback_users, [<<"guest">>]},
 ##
 # loopback_users.guest = true
 
 ## Uncomment the following line if you want to allow access to the
 ## guest user from anywhere on the network.
 # loopback_users.guest = false
 
 ## TLS configuration.
 ##
 ## Related doc guide: https://rabbitmq.com/ssl.html.
 ##
 # listeners.ssl.1                 = 5671
 #
 # ssl_options.verify               = verify_peer
 # ssl_options.fail_if_no_peer_cert = false
 # ssl_options.cacertfile           = /path/to/cacert.pem
 # ssl_options.certfile             = /path/to/cert.pem
 # ssl_options.keyfile             = /path/to/key.pem
 #
 # ssl_options.honor_cipher_order   = true
 # ssl_options.honor_ecc_order     = true
 #
 ## These are highly recommended for TLSv1.2 but cannot be used
 ## with TLSv1.3. If TLSv1.3 is enabled, these lines MUST be removed.
 # ssl_options.client_renegotiation = false
 # ssl_options.secure_renegotiate   = true
 #
 ## Limits what TLS versions the server enables for client TLS
 ## connections. See https://www.rabbitmq.com/ssl.html#tls-versions for details.
 ##
 ## Cutting edge TLS version which requires recent client runtime
 ## versions and has no cipher suite in common with earlier TLS versions.
 # ssl_options.versions.1 = tlsv1.3
 ## Enables TLSv1.2 for best compatibility
 # ssl_options.versions.2 = tlsv1.2
 ## Older TLS versions have known vulnerabilities and are being phased out
 ## from wide use.
 
 ## Limits what cipher suites the server will use for client TLS
 ## connections. Narrowing this down can prevent some clients
 ## from connecting.
 ## If TLSv1.3 is enabled and cipher suites are overridden, TLSv1.3-specific
 ## cipher suites must also be explicitly enabled.
 ## See https://www.rabbitmq.com/ssl.html#cipher-suites and https://wiki.openssl.org/index.php/TLS1.3#Ciphersuites
 ## for details.
 #
 ## The example below uses TLSv1.3 cipher suites only
 #
 # ssl_options.ciphers.1 = TLS_AES_256_GCM_SHA384
 # ssl_options.ciphers.2 = TLS_AES_128_GCM_SHA256
 # ssl_options.ciphers.3 = TLS_CHACHA20_POLY1305_SHA256
 # ssl_options.ciphers.4 = TLS_AES_128_CCM_SHA256
 # ssl_options.ciphers.5 = TLS_AES_128_CCM_8_SHA256
 #
 ## The example below uses TLSv1.2 cipher suites only
 #
 # ssl_options.ciphers.1 = ECDHE-ECDSA-AES256-GCM-SHA384
 # ssl_options.ciphers.2 = ECDHE-RSA-AES256-GCM-SHA384
 # ssl_options.ciphers.3 = ECDHE-ECDSA-AES256-SHA384
 # ssl_options.ciphers.4 = ECDHE-RSA-AES256-SHA384
 # ssl_options.ciphers.5 = ECDH-ECDSA-AES256-GCM-SHA384
 # ssl_options.ciphers.6 = ECDH-RSA-AES256-GCM-SHA384
 # ssl_options.ciphers.7 = ECDH-ECDSA-AES256-SHA384
 # ssl_options.ciphers.8 = ECDH-RSA-AES256-SHA384
 # ssl_options.ciphers.9 = DHE-RSA-AES256-GCM-SHA384
 # ssl_options.ciphers.10 = DHE-DSS-AES256-GCM-SHA384
 # ssl_options.ciphers.11 = DHE-RSA-AES256-SHA256
 # ssl_options.ciphers.12 = DHE-DSS-AES256-SHA256
 # ssl_options.ciphers.13 = ECDHE-ECDSA-AES128-GCM-SHA256
 # ssl_options.ciphers.14 = ECDHE-RSA-AES128-GCM-SHA256
 # ssl_options.ciphers.15 = ECDHE-ECDSA-AES128-SHA256
 # ssl_options.ciphers.16 = ECDHE-RSA-AES128-SHA256
 # ssl_options.ciphers.17 = ECDH-ECDSA-AES128-GCM-SHA256
 # ssl_options.ciphers.18 = ECDH-RSA-AES128-GCM-SHA256
 # ssl_options.ciphers.19 = ECDH-ECDSA-AES128-SHA256
 # ssl_options.ciphers.20 = ECDH-RSA-AES128-SHA256
 # ssl_options.ciphers.21 = DHE-RSA-AES128-GCM-SHA256
 # ssl_options.ciphers.22 = DHE-DSS-AES128-GCM-SHA256
 # ssl_options.ciphers.23 = DHE-RSA-AES128-SHA256
 # ssl_options.ciphers.24 = DHE-DSS-AES128-SHA256
 # ssl_options.ciphers.25 = ECDHE-ECDSA-AES256-SHA
 # ssl_options.ciphers.26 = ECDHE-RSA-AES256-SHA
 # ssl_options.ciphers.27 = DHE-RSA-AES256-SHA
 # ssl_options.ciphers.28 = DHE-DSS-AES256-SHA
 # ssl_options.ciphers.29 = ECDH-ECDSA-AES256-SHA
 # ssl_options.ciphers.30 = ECDH-RSA-AES256-SHA
 # ssl_options.ciphers.31 = ECDHE-ECDSA-AES128-SHA
 # ssl_options.ciphers.32 = ECDHE-RSA-AES128-SHA
 # ssl_options.ciphers.33 = DHE-RSA-AES128-SHA
 # ssl_options.ciphers.34 = DHE-DSS-AES128-SHA
 # ssl_options.ciphers.35 = ECDH-ECDSA-AES128-SHA
 # ssl_options.ciphers.36 = ECDH-RSA-AES128-SHA
 
 # ssl_options.bypass_pem_cache = true
 
 ## Select an authentication/authorisation backend to use.
 ##
 ## Alternative backends are provided by plugins, such as rabbitmq-auth-backend-ldap.
 ##
 ## NB: These settings require certain plugins to be enabled.
 ##
 ## Related doc guides:
 ##
 ## * https://rabbitmq.com/plugins.html
 ## * https://rabbitmq.com/access-control.html
 ##
 
 # auth_backends.1   = rabbit_auth_backend_internal
 
 ## uses separate backends for authentication and authorisation,
 ## see below.
 # auth_backends.1.authn = rabbit_auth_backend_ldap
 # auth_backends.1.authz = rabbit_auth_backend_internal
 
 ## The rabbitmq_auth_backend_ldap plugin allows the broker to
 ## perform authentication and authorisation by deferring to an
 ## external LDAP server.
 ##
 ## Relevant doc guides:
 ##
 ## * https://rabbitmq.com/ldap.html
 ## * https://rabbitmq.com/access-control.html
 ##
 ## uses LDAP for both authentication and authorisation
 # auth_backends.1 = rabbit_auth_backend_ldap
 
 ## uses HTTP service for both authentication and
 ## authorisation
 # auth_backends.1 = rabbit_auth_backend_http
 
 ## uses two backends in a chain: HTTP first, then internal
 # auth_backends.1   = rabbit_auth_backend_http
 # auth_backends.2   = rabbit_auth_backend_internal
 
 ## Authentication
 ## The built-in mechanisms are 'PLAIN',
 ## 'AMQPLAIN', and 'EXTERNAL' Additional mechanisms can be added via
 ## plugins.
 ##
 ## Related doc guide: https://rabbitmq.com/authentication.html.
 ##
 # auth_mechanisms.1 = PLAIN
 # auth_mechanisms.2 = AMQPLAIN
 
 ## The rabbitmq-auth-mechanism-ssl plugin makes it possible to
 ## authenticate a user based on the client's x509 (TLS) certificate.
 ## Related doc guide: https://rabbitmq.com/authentication.html.
 ##
 ## To use auth-mechanism-ssl, the EXTERNAL mechanism should
 ## be enabled:
 ##
 # auth_mechanisms.1 = PLAIN
 # auth_mechanisms.2 = AMQPLAIN
 # auth_mechanisms.3 = EXTERNAL
 
 ## To force x509 certificate-based authentication on all clients,
 ## exclude all other mechanisms (note: this will disable password-based
 ## authentication even for the management UI!):
 ##
 # auth_mechanisms.1 = EXTERNAL
 
 ## This pertains to both the rabbitmq-auth-mechanism-ssl plugin and
 ## STOMP ssl_cert_login configurations. See the RabbitMQ STOMP plugin
 ## configuration section later in this file and the README in
 ## https://github.com/rabbitmq/rabbitmq-auth-mechanism-ssl for further
 ## details.
 ##
 ## To use the TLS cert's CN instead of its DN as the username
 ##
 # ssl_cert_login_from   = common_name
 
 ## TLS handshake timeout, in milliseconds.
 ##
 # ssl_handshake_timeout = 5000
 
 
 ## Cluster name
 ##
 # cluster_name = dev3.eng.megacorp.local
 
 ## Password hashing implementation. Will only affect newly
 ## created users. To recalculate hash for an existing user
 ## it's necessary to update her password.
 ##
 ## To use SHA-512, set to rabbit_password_hashing_sha512.
 ##
 # password_hashing_module = rabbit_password_hashing_sha256
 
 ## When importing definitions exported from versions earlier
 ## than 3.6.0, it is possible to go back to MD5 (only do this
 ## as a temporary measure!) by setting this to rabbit_password_hashing_md5.
 ##
 # password_hashing_module = rabbit_password_hashing_md5
 
 ##
 ## Default User / VHost
 ## ====================
 ##
 
 ## On first start RabbitMQ will create a vhost and a user. These
 ## config items control what gets created.
 ## Relevant doc guide: https://rabbitmq.com/access-control.html
 ##
 # default_vhost = /
 # default_user = guest
 # default_pass = guest
 
 # default_permissions.configure = .*
 # default_permissions.read = .*
 # default_permissions.write = .*
 
 ## Tags for default user
 ##
 ## For more details about tags, see the documentation for the
 ## Management Plugin at https://rabbitmq.com/management.html.
 ##
 # default_user_tags.administrator = true
 
 ## Define other tags like this:
 # default_user_tags.management = true
 # default_user_tags.custom_tag = true
 
 ##
 ## Additional network and protocol related configuration
 ## =====================================================
 ##
 
 ## Set the server AMQP 0-9-1 heartbeat timeout in seconds.
 ## RabbitMQ nodes will send heartbeat frames at roughly
 ## the (timeout / 2) interval. Two missed heartbeats from
 ## a client will close its connection.
 ##
 ## Values lower than 6 seconds are very likely to produce
 ## false positives and are not recommended.
 ##
 ## Related doc guides:
 ##
 ## * https://rabbitmq.com/heartbeats.html
 ## * https://rabbitmq.com/networking.html
 ##
 # heartbeat = 60
 
 ## Set the max permissible size of an AMQP frame (in bytes).
 ##
 # frame_max = 131072
 
 ## Set the max frame size the server will accept before connection
 ## tuning occurs
 ##
 # initial_frame_max = 4096
 
 ## Set the max permissible number of channels per connection.
 ## 0 means "no limit".
 ##
 # channel_max = 128
 
 ## Customising TCP Listener (Socket) Configuration.
 ##
 ## Related doc guides:
 ##
 ## * https://rabbitmq.com/networking.html
 ## * https://www.erlang.org/doc/man/inet.html#setopts-2
 ##
 
 # tcp_listen_options.backlog = 128
 # tcp_listen_options.nodelay = true
 # tcp_listen_options.exit_on_close = false
 #
 # tcp_listen_options.keepalive = true
 # tcp_listen_options.send_timeout = 15000
 #
 # tcp_listen_options.buffer = 196608
 # tcp_listen_options.sndbuf = 196608
 # tcp_listen_options.recbuf = 196608
 
 ##
 ## Resource Limits & Flow Control
 ## ==============================
 ##
 ## Related doc guide: https://rabbitmq.com/memory.html.
 
 ## Memory-based Flow Control threshold.
 ##
 # vm_memory_high_watermark.relative = 0.4
 
 ## Alternatively, we can set a limit (in bytes) of RAM used by the node.
 ##
 # vm_memory_high_watermark.absolute = 1073741824
 
 ## Or you can set absolute value using memory units (with RabbitMQ 3.6.0+).
 ## Absolute watermark will be ignored if relative is defined!
 ##
 # vm_memory_high_watermark.absolute = 2GB
 ##
 ## Supported unit symbols:
 ##
 ## k, kiB: kibibytes (2^10 - 1,024 bytes)
 ## M, MiB: mebibytes (2^20 - 1,048,576 bytes)
 ## G, GiB: gibibytes (2^30 - 1,073,741,824 bytes)
 ## kB: kilobytes (10^3 - 1,000 bytes)
 ## MB: megabytes (10^6 - 1,000,000 bytes)
 ## GB: gigabytes (10^9 - 1,000,000,000 bytes)
 
 
 
 ## Fraction of the high watermark limit at which queues start to
 ## page message out to disc in order to free up memory.
 ## For example, when vm_memory_high_watermark is set to 0.4 and this value is set to 0.5,
 ## paging can begin as early as when 20% of total available RAM is used by the node.
 ##
 ## Values greater than 1.0 can be dangerous and should be used carefully.
 ##
 ## One alternative to this is to use durable queues and publish messages
 ## as persistent (delivery mode = 2). With this combination queues will
 ## move messages to disk much more rapidly.
 ##
 ## Another alternative is to configure queues to page all messages (both
 ## persistent and transient) to disk as quickly
 ## as possible, see https://rabbitmq.com/lazy-queues.html.
 ##
 # vm_memory_high_watermark_paging_ratio = 0.5
 
 ## Selects Erlang VM memory consumption calculation strategy. Can be `allocated`, `rss` or `legacy` (aliased as `erlang`),
 ## Introduced in 3.6.11. `rss` is the default as of 3.6.12.
 ## See https://github.com/rabbitmq/rabbitmq-server/issues/1223 and rabbitmq/rabbitmq-common#224 for background.
 # vm_memory_calculation_strategy = rss
 
 ## Interval (in milliseconds) at which we perform the check of the memory
 ## levels against the watermarks.
 ##
 # memory_monitor_interval = 2500
 
 ## The total memory available can be calculated from the OS resources
 ## - default option - or provided as a configuration parameter.
 # total_memory_available_override_value = 2GB
 
 ## Set disk free limit (in bytes). Once free disk space reaches this
 ## lower bound, a disk alarm will be set - see the documentation
 ## listed above for more details.
 ##
 ## Absolute watermark will be ignored if relative is defined!
 # disk_free_limit.absolute = 50000
 
 ## Or you can set it using memory units (same as in vm_memory_high_watermark)
 ## with RabbitMQ 3.6.0+.
 # disk_free_limit.absolute = 500KB
 # disk_free_limit.absolute = 50mb
 # disk_free_limit.absolute = 5GB
 
 ## Alternatively, we can set a limit relative to total available RAM.
 ##
 ## Values lower than 1.0 can be dangerous and should be used carefully.
 # disk_free_limit.relative = 2.0
 
 ##
 ## Clustering
 ## =====================
 ##
 # cluster_partition_handling = ignore
 
 ## Pauses all nodes on the minority side of a partition. The cluster
 ## MUST have an odd number of nodes (3, 5, etc)
 # cluster_partition_handling = pause_minority
 
 ## pause_if_all_down strategy require additional configuration
 # cluster_partition_handling = pause_if_all_down
 
 ## Recover strategy. Can be either 'autoheal' or 'ignore'
 # cluster_partition_handling.pause_if_all_down.recover = ignore
 
 ## Node names to check
 # cluster_partition_handling.pause_if_all_down.nodes.1 = rabbit@localhost
 # cluster_partition_handling.pause_if_all_down.nodes.2 = hare@localhost
 
 ## Mirror sync batch size, in messages. Increasing this will speed
 ## up syncing but total batch size in bytes must not exceed 2 GiB.
 ## Available in RabbitMQ 3.6.0 or later.
 ##
 # mirroring_sync_batch_size = 4096
 
 ## Make clustering happen *automatically* at startup. Only applied
 ## to nodes that have just been reset or started for the first time.
 ##
 ## Relevant doc guide: https://rabbitmq.com//cluster-formation.html
 ##
 
 # cluster_formation.peer_discovery_backend     = rabbit_peer_discovery_classic_config
 #
 # cluster_formation.classic_config.nodes.1 = rabbit1@hostname
 # cluster_formation.classic_config.nodes.2 = rabbit2@hostname
 # cluster_formation.classic_config.nodes.3 = rabbit3@hostname
 # cluster_formation.classic_config.nodes.4 = rabbit4@hostname
 
 ## DNS-based peer discovery. This backend will list A records
 ## of the configured hostname and perform reverse lookups for
 ## the addresses returned.
 
 # cluster_formation.peer_discovery_backend = rabbit_peer_discovery_dns
 # cluster_formation.dns.hostname = discovery.eng.example.local
 
 ## This node's type can be configured. If you are not sure
 ## what node type to use, always use 'disc'.
 # cluster_formation.node_type = disc
 
 ## Interval (in milliseconds) at which we send keepalive messages
 ## to other cluster members. Note that this is not the same thing
 ## as net_ticktime; missed keepalive messages will not cause nodes
 ## to be considered down.
 ##
 # cluster_keepalive_interval = 10000
 
 ##
 ## Statistics Collection
 ## =====================
 ##
 
 ## Statistics collection interval (in milliseconds). Increasing
 ## this will reduce the load on management database.
 ##
 # collect_statistics_interval = 5000
 
 ## Fine vs. coarse statistics
 #
 # This value is no longer meant to be configured directly.
 #
 # See https://www.rabbitmq.com/management.html#fine-stats.
 
 ##
 ## Ra Settings
 ## =====================
 ##
 ## NB: changing these on a node with existing data directory
 ##     can lead to DATA LOSS.
 ##
 # raft.segment_max_entries = 65536
 # raft.wal_max_size_bytes = 1048576
 # raft.wal_max_batch_size = 4096
 # raft.snapshot_chunk_size = 1000000
 
 ##
 ## Misc/Advanced Options
 ## =====================
 ##
 ## NB: Change these only if you understand what you are doing!
 ##
 
 ## Timeout used when waiting for Mnesia tables in a cluster to
 ## become available.
 ##
 # mnesia_table_loading_retry_timeout = 30000
 
 ## Retries when waiting for Mnesia tables in the cluster startup. Note that
 ## this setting is not applied to Mnesia upgrades or node deletions.
 ##
 # mnesia_table_loading_retry_limit = 10
 
 ## Size in bytes below which to embed messages in the queue index.
 ## Related doc guide: https://rabbitmq.com/persistence-conf.html
 ##
 # queue_index_embed_msgs_below = 4096
 
 ## You can also set this size in memory units
 ##
 # queue_index_embed_msgs_below = 4kb
 
 ## Whether or not to enable background periodic forced GC runs for all
 ## Erlang processes on the node in "waiting" state.
 ##
 ## Disabling background GC may reduce latency for client operations,
 ## keeping it enabled may reduce median RAM usage by the binary heap
 ## (see https://www.erlang-solutions.com/blog/erlang-garbage-collector.html).
 ##
 ## Before trying this option, please take a look at the memory
 ## breakdown (https://www.rabbitmq.com/memory-use.html).
 ##
 # background_gc_enabled = false
 
 ## Target (desired) interval (in milliseconds) at which we run background GC.
 ## The actual interval will vary depending on how long it takes to execute
 ## the operation (can be higher than this interval). Values less than
 ## 30000 milliseconds are not recommended.
 ##
 # background_gc_target_interval = 60000
 
 ## Whether or not to enable proxy protocol support.
 ## Once enabled, clients cannot directly connect to the broker
 ## anymore. They must connect through a load balancer that sends the
 ## proxy protocol header to the broker at connection time.
 ## This setting applies only to AMQP clients, other protocols
 ## like MQTT or STOMP have their own setting to enable proxy protocol.
 ## See the plugins documentation for more information.
 ##
 # proxy_protocol = false
 
 ## Overriden product name and version.
 ## They are set to "RabbitMQ" and the release version by default.
 # product.name = RabbitMQ
 # product.version = 1.2.3
 
 ## "Message of the day" file.
 ## Its content is used to expand the logged and printed banners.
 ## Default to /etc/rabbitmq/motd on Unix, %APPDATA%\RabbitMQ\motd.txt
 ## on Windows.
 # motd_file = /etc/rabbitmq/motd
 
 ## Consumer timeout
 ## If a message delivered to a consumer has not been acknowledge before this timer
 ## triggers the channel will be force closed by the broker. This ensure that
 ## faultly consumers that never ack will not hold on to messages indefinitely.
 ##
 # consumer_timeout = 900000
 
 ## ----------------------------------------------------------------------------
 ## Advanced Erlang Networking/Clustering Options.
 ##
 ## Related doc guide: https://rabbitmq.com/clustering.html
 ## ----------------------------------------------------------------------------
 
 # ======================================
 # Kernel section
 # ======================================
 
 ## Timeout used to detect peer unavailability, including CLI tools.
 ## Related doc guide: https://www.rabbitmq.com/nettick.html.
 ##
 # net_ticktime = 60
 
 ## Inter-node communication port range.
 ## The parameters inet_dist_listen_min and inet_dist_listen_max
 ## can be configured in the classic config format only.
 ## Related doc guide: https://www.rabbitmq.com/networking.html#epmd-inet-dist-port-range.
 
 
 ## ----------------------------------------------------------------------------
 ## RabbitMQ Management Plugin
 ##
 ## Related doc guide: https://rabbitmq.com/management.html.
 ## ----------------------------------------------------------------------------
 
 # =======================================
 # Management section
 # =======================================
 
 ## Preload schema definitions from the following JSON file.
 ## Related doc guide: https://rabbitmq.com/management.html#load-definitions.
 ##
 # management.load_definitions = /path/to/exported/definitions.json
 
 ## Log all requests to the management HTTP API to a file.
 ##
 # management.http_log_dir = /path/to/access.log
 
 ## HTTP listener and embedded Web server settings.
 # ## See https://rabbitmq.com/management.html for details.
 #
 # management.tcp.port = 15672
 # management.tcp.ip   = 0.0.0.0
 #
 # management.tcp.shutdown_timeout   = 7000
 # management.tcp.max_keepalive     = 120
 # management.tcp.idle_timeout       = 120
 # management.tcp.inactivity_timeout = 120
 # management.tcp.request_timeout   = 120
 # management.tcp.compress           = true
 
 ## HTTPS listener settings.
 ## See https://rabbitmq.com/management.html and https://rabbitmq.com/ssl.html for details.
 ##
 # management.ssl.port       = 15671
 # management.ssl.cacertfile = /path/to/ca_certificate.pem
 # management.ssl.certfile   = /path/to/server_certificate.pem
 # management.ssl.keyfile   = /path/to/server_key.pem
 
 ## More TLS options
 # management.ssl.honor_cipher_order   = true
 # management.ssl.honor_ecc_order     = true
 
 ## These are highly recommended for TLSv1.2 but cannot be used
 ## with TLSv1.3. If TLSv1.3 is enabled, these lines MUST be removed.
 # management.ssl.client_renegotiation = false
 # management.ssl.secure_renegotiate   = true
 
 ## Supported TLS versions
 # management.ssl.versions.1 = tlsv1.2
 
 ## Cipher suites the server is allowed to use
 # management.ssl.ciphers.1 = ECDHE-ECDSA-AES256-GCM-SHA384
 # management.ssl.ciphers.2 = ECDHE-RSA-AES256-GCM-SHA384
 # management.ssl.ciphers.3 = ECDHE-ECDSA-AES256-SHA384
 # management.ssl.ciphers.4 = ECDHE-RSA-AES256-SHA384
 # management.ssl.ciphers.5 = ECDH-ECDSA-AES256-GCM-SHA384
 # management.ssl.ciphers.6 = ECDH-RSA-AES256-GCM-SHA384
 # management.ssl.ciphers.7 = ECDH-ECDSA-AES256-SHA384
 # management.ssl.ciphers.8 = ECDH-RSA-AES256-SHA384
 # management.ssl.ciphers.9 = DHE-RSA-AES256-GCM-SHA384
 
 ## URL path prefix for HTTP API and management UI
 # management.path_prefix = /a-prefix
 
 ## One of 'basic', 'detailed' or 'none'. See
 ## https://rabbitmq.com/management.html#fine-stats for more details.
 # management.rates_mode = basic
 
 ## Configure how long aggregated data (such as message rates and queue
 ## lengths) is retained. Please read the plugin's documentation in
 ## https://rabbitmq.com/management.html#configuration for more
 ## details.
 ## Your can use 'minute', 'hour' and 'day' keys or integer key (in seconds)
 # management.sample_retention_policies.global.minute   = 5
 # management.sample_retention_policies.global.hour = 60
 # management.sample_retention_policies.global.day = 1200
 
 # management.sample_retention_policies.basic.minute   = 5
 # management.sample_retention_policies.basic.hour = 60
 
 # management.sample_retention_policies.detailed.10 = 5
 
 ## ----------------------------------------------------------------------------
 ## RabbitMQ Shovel Plugin
 ##
 ## Related doc guide: https://rabbitmq.com/shovel.html
 ## ----------------------------------------------------------------------------
 
 ## See advanced.config.example for a Shovel plugin example
 
 
 ## ----------------------------------------------------------------------------
 ## RabbitMQ STOMP Plugin
 ##
 ## Related doc guide: https://rabbitmq.com/stomp.html
 ## ----------------------------------------------------------------------------
 
 # =======================================
 # STOMP section
 # =======================================
 
 ## See https://rabbitmq.com/stomp.html for details.
 
 ## TCP listeners.
 ##
 # stomp.listeners.tcp.1 = 127.0.0.1:61613
 # stomp.listeners.tcp.2 = ::1:61613
 
 ## TCP listener settings
 ##
 # stomp.tcp_listen_options.backlog   = 2048
 # stomp.tcp_listen_options.recbuf   = 131072
 # stomp.tcp_listen_options.sndbuf   = 131072
 #
 # stomp.tcp_listen_options.keepalive = true
 # stomp.tcp_listen_options.nodelay   = true
 #
 # stomp.tcp_listen_options.exit_on_close = true
 # stomp.tcp_listen_options.send_timeout = 120
 
 ## Proxy protocol support
 ##
 # stomp.proxy_protocol = false
 
 ## TLS listeners
 ## See https://rabbitmq.com/stomp.html and https://rabbitmq.com/ssl.html for details.
 # stomp.listeners.ssl.default = 61614
 #
 # ssl_options.cacertfile = path/to/cacert.pem
 # ssl_options.certfile   = path/to/cert.pem
 # ssl_options.keyfile   = path/to/key.pem
 # ssl_options.verify     = verify_peer
 # ssl_options.fail_if_no_peer_cert = true
 
 
 ## Number of Erlang processes that will accept connections for the TCP
 ## and TLS listeners.
 ##
 # stomp.num_acceptors.tcp = 10
 # stomp.num_acceptors.ssl = 1
 
 ## Additional TLS options
 
 ## Extract a name from the client's certificate when using TLS.
 ##
 # stomp.ssl_cert_login = true
 
 ## Set a default user name and password. This is used as the default login
 ## whenever a CONNECT frame omits the login and passcode headers.
 ##
 ## Please note that setting this will allow clients to connect without
 ## authenticating!
 ##
 # stomp.default_user = guest
 # stomp.default_pass = guest
 
 ## If a default user is configured, or you have configured use TLS client
 ## certificate based authentication, you can choose to allow clients to
 ## omit the CONNECT frame entirely. If set to true, the client is
 ## automatically connected as the default user or user supplied in the
 ## TLS certificate whenever the first frame sent on a session is not a
 ## CONNECT frame.
 ##
 # stomp.implicit_connect = true
 
 ## Whether or not to enable proxy protocol support.
 ## Once enabled, clients cannot directly connect to the broker
 ## anymore. They must connect through a load balancer that sends the
 ## proxy protocol header to the broker at connection time.
 ## This setting applies only to STOMP clients, other protocols
 ## like MQTT or AMQP have their own setting to enable proxy protocol.
 ## See the plugins or broker documentation for more information.
 ##
 # stomp.proxy_protocol = false
 
 ## ----------------------------------------------------------------------------
 ## RabbitMQ MQTT Adapter
 ##
 ## See https://github.com/rabbitmq/rabbitmq-mqtt/blob/stable/README.md
 ## for details
 ## ----------------------------------------------------------------------------
 
 # =======================================
 # MQTT section
 # =======================================
 
 ## TCP listener settings.
 ##
 # mqtt.listeners.tcp.1 = 127.0.0.1:61613
 # mqtt.listeners.tcp.2 = ::1:61613
 
 ## TCP listener options (as per the broker configuration).
 ##
 # mqtt.tcp_listen_options.backlog = 4096
 # mqtt.tcp_listen_options.recbuf = 131072
 # mqtt.tcp_listen_options.sndbuf = 131072
 #
 # mqtt.tcp_listen_options.keepalive = true
 # mqtt.tcp_listen_options.nodelay   = true
 #
 # mqtt.tcp_listen_options.exit_on_close = true
 # mqtt.tcp_listen_options.send_timeout = 120
 
 ## TLS listener settings
 ## ## See https://rabbitmq.com/mqtt.html and https://rabbitmq.com/ssl.html for details.
 #
 # mqtt.listeners.ssl.default = 8883
 #
 # ssl_options.cacertfile = /path/to/tls/ca_certificate_bundle.pem
 # ssl_options.certfile   = /path/to/tls/server_certificate.pem
 # ssl_options.keyfile   = /path/to/tls/server_key.pem
 # ssl_options.verify     = verify_peer
 # ssl_options.fail_if_no_peer_cert = true
 #
 
 
 ## Number of Erlang processes that will accept connections for the TCP
 ## and TLS listeners.
 ##
 # mqtt.num_acceptors.tcp = 10
 # mqtt.num_acceptors.ssl = 10
 
 ## Whether or not to enable proxy protocol support.
 ## Once enabled, clients cannot directly connect to the broker
 ## anymore. They must connect through a load balancer that sends the
 ## proxy protocol header to the broker at connection time.
 ## This setting applies only to STOMP clients, other protocols
 ## like STOMP or AMQP have their own setting to enable proxy protocol.
 ## See the plugins or broker documentation for more information.
 ##
 # mqtt.proxy_protocol = false
 
 ## Set the default user name and password used for anonymous connections (when client
 ## provides no credentials). Anonymous connections are highly discouraged!
 ##
 # mqtt.default_user = guest
 # mqtt.default_pass = guest
 
 ## Enable anonymous connections. If this is set to false, clients MUST provide
 ## credentials in order to connect. See also the mqtt.default_user/mqtt.default_pass
 ## keys. Anonymous connections are highly discouraged!
 ##
 # mqtt.allow_anonymous = true
 
 ## If you have multiple vhosts, specify the one to which the
 ## adapter connects.
 ##
 # mqtt.vhost = /
 
 ## Specify the exchange to which messages from MQTT clients are published.
 ##
 # mqtt.exchange = amq.topic
 
 ## Specify TTL (time to live) to control the lifetime of non-clean sessions.
 ##
 # mqtt.subscription_ttl = 1800000
 
 ## Set the prefetch count (governing the maximum number of unacknowledged
 ## messages that will be delivered).
 ##
 # mqtt.prefetch = 10
 
 
 ## ----------------------------------------------------------------------------
 ## RabbitMQ AMQP 1.0 Support
 ##
 ## See https://github.com/rabbitmq/rabbitmq-amqp1.0/blob/stable/README.md.
 ## ----------------------------------------------------------------------------
 
 # =======================================
 # AMQP 1.0 section
 # =======================================
 
 
 ## Connections that are not authenticated with SASL will connect as this
 ## account. See the README for more information.
 ##
 ## Please note that setting this will allow clients to connect without
 ## authenticating!
 ##
 # amqp1_0.default_user = guest
 
 ## Enable protocol strict mode. See the README for more information.
 ##
 # amqp1_0.protocol_strict_mode = false
 
 ## Logging settings.
 ##
 ## See https://rabbitmq.com/logging.html and https://github.com/erlang-lager/lager for details.
 ##
 
 ## Log directory, taken from the RABBITMQ_LOG_BASE env variable by default.
 ##
 # log.dir = /var/log/rabbitmq
 
 ## Logging to file. Can be false or a filename.
 ## Default:
 # log.file = rabbit.log
 
 ## To disable logging to a file
 # log.file = false
 
 ## Log level for file logging
 ##
 # log.file.level = info
 
 ## File rotation config. No rotation by default.
 ## DO NOT SET rotation date to ''. Leave the value unset if "" is the desired value
 # log.file.rotation.date = $D0
 # log.file.rotation.size = 0
 
 ## Logging to console (can be true or false)
 ##
 # log.console = false
 
 ## Log level for console logging
 ##
 # log.console.level = info
 
 ## Logging to the amq.rabbitmq.log exchange (can be true or false)
 ##
 # log.exchange = false
 
 ## Log level to use when logging to the amq.rabbitmq.log exchange
 ##
 # log.exchange.level = info
 
 
 
 ## ----------------------------------------------------------------------------
 ## RabbitMQ LDAP Plugin
 ##
 ## Related doc guide: https://rabbitmq.com/ldap.html.
 ##
 ## ----------------------------------------------------------------------------
 
 # =======================================
 # LDAP section
 # =======================================
 
 ##
 ## Connecting to the LDAP server(s)
 ## ================================
 ##
 
 ## Specify servers to bind to. You *must* set this in order for the plugin
 ## to work properly.
 ##
 # auth_ldap.servers.1 = your-server-name-goes-here
 
 ## You can define multiple servers
 # auth_ldap.servers.2 = your-other-server
 
 ## Connect to the LDAP server using TLS
 ##
 # auth_ldap.use_ssl = false
 
 ## Specify the LDAP port to connect to
 ##
 # auth_ldap.port = 389
 
 ## LDAP connection timeout, in milliseconds or 'infinity'
 ##
 # auth_ldap.timeout = infinity
 
 ## Or number
 # auth_ldap.timeout = 500
 
 ## Enable logging of LDAP queries.
 ## One of
 ##   - false (no logging is performed)
 ##   - true (verbose logging of the logic used by the plugin)
 ##   - network (as true, but additionally logs LDAP network traffic)
 ##
 ## Defaults to false.
 ##
 # auth_ldap.log = false
 
 ## Also can be true or network
 # auth_ldap.log = true
 # auth_ldap.log = network
 
 ##
 ## Authentication
 ## ==============
 ##
 
 ## Pattern to convert the username given through AMQP to a DN before
 ## binding
 ##
 # auth_ldap.user_dn_pattern = cn=${username},ou=People,dc=example,dc=com
 
 ## Alternatively, you can convert a username to a Distinguished
 ## Name via an LDAP lookup after binding. See the documentation for
 ## full details.
 
 ## When converting a username to a dn via a lookup, set these to
 ## the name of the attribute that represents the user name, and the
 ## base DN for the lookup query.
 ##
 # auth_ldap.dn_lookup_attribute = userPrincipalName
 # auth_ldap.dn_lookup_base     = DC=gopivotal,DC=com
 
 ## Controls how to bind for authorisation queries and also to
 ## retrieve the details of users logging in without presenting a
 ## password (e.g., SASL EXTERNAL).
 ## One of
 ## - as_user (to bind as the authenticated user - requires a password)
 ## - anon   (to bind anonymously)
 ## - {UserDN, Password} (to bind with a specified user name and password)
 ##
 ## Defaults to 'as_user'.
 ##
 # auth_ldap.other_bind = as_user
 
 ## Or can be more complex:
 # auth_ldap.other_bind.user_dn = User
 # auth_ldap.other_bind.password = Password
 
 ## If user_dn and password defined - other options is ignored.
 
 # -----------------------------
 # Too complex section of LDAP
 # -----------------------------
 
 ##
 ## Authorisation
 ## =============
 ##
 
 ## The LDAP plugin can perform a variety of queries against your
 ## LDAP server to determine questions of authorisation.
 ##
 ## Related doc guide: https://rabbitmq.com/ldap.html#authorisation.
 
 ## Following configuration should be defined in advanced.config file
 ## DO NOT UNCOMMENT THESE LINES!
 
 ## Set the query to use when determining vhost access
 ##
 ## {vhost_access_query, {in_group,
 ##                       "ou=${vhost}-users,ou=vhosts,dc=example,dc=com"}},
 
 ## Set the query to use when determining resource (e.g., queue) access
 ##
 ## {resource_access_query, {constant, true}},
 
 ## Set queries to determine which tags a user has
 ##
 ## {tag_queries, []}
 #   ]},
 # -----------------------------

如果有调整,调整后保存退出

1.7开启端口或者关闭防火墙

  • 临时关闭防火墙

 [root@sjz1 rabbitmq]# systemctl stop firewalld
 [root@sjz1 rabbitmq]# systemctl status firewalld
 ● firewalld.service - firewalld - dynamic firewall daemon
    Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
    Active: inactive (dead)
      Docs: man:firewalld(1)
  • 开启相关端口

#开启端口
firewall-cmd --zone=public --add-port=5672/tcp --permanent
firewall-cmd --zone=public --add-port=15672/tcp --permanent

#更新防火墙规则
firewall-cmd --complete-reload

#查看当前所开放端口
firewall-cmd --zone=public --list-ports

1.8 启动Rabbitmq

 [root@sjz1 rabbitmq]# rabbitmq-server start -detached
 
 #关闭
 rabbitmq-server stop
 
 #查看状态
 rabbitmq-server status

1.9建立新用户

  • rabbitmq有一个默认的用户名和密码,guest和guest,但为了安全考虑,该用户名和密码只允许本地访问;

  • 如果是远程操作的话,需要创建新的用户名和密码;

 rabbitmqctl add_user username passwd  //添加用户,后面两个参数分别是用户名和密码
 rabbitmqctl set_permissions -p / username ".*" ".*" ".*"  //添加权限
 rabbitmqctl set_user_tags username administrator  //修改用户角色,将用户设为管理员

1.10进入Rabbitmq管理界面


2、普通集群搭建

2.1停止全部MQ服务节点

  • 在3台mq服务器上都执行以下命令:

 rabbitmqctl stop

2.2文件(.erlang.cookie)同步

 #文件同步思路:
 选择1、2、3任意一个节点为Master(这里选择1为Master),
 简言之:需要把1的Cookie文件同步到2、3节点上去,进入/root/.erlang.cookie目录下,把.erlang.cookie文件copy到各个slave节点下
 [root@sjz1 rabbitmq]# find / -name .erlang.cookiefi
 /root/.erlang.cookie

2.3组成集群操作

 #集群思路:
 #配置1、2、3为集群模式,3个节点(1、2、3)执行启动命令,后续启动集群使用此命令即可
 
 #重新启动3台mq服务,以下命令都执行一次
 
 #启动rabbitmq服务
 #rabbitmq-server start -detached
 
 查看RabbitMQ服务是否启动
 
 lsof -i :5672
 [root@sjz1 rabbitmq]# lsof -i :5672
 COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
 beam.smp 28796 root   99u IPv6 376552     0t0 TCP *:amqp (LISTEN)

2.4slave加入集群操作

(重新加入集群也是如此,以最开始的主节点为加入节点) ps:注意做这个步骤的时候:需要配置/etc/hosts 必须相互能够寻址到

 #在mq-02服务器上停止mq服务
 [root@sjz2 ~]# rabbitmqctl stop_app
 #将mq-02 加入集群
 [root@sjz2 ~]# rabbitmqctl join_cluster --ram rabbit@sjz1
 #重新启动mq服务
 [root@sjz2 ~]# rabbitmqctl start_app
 
 #在mq-03服务器上停止mq服务
 [root@sjz3 ~]# rabbitmqctl stop_app
 #将mq-03 加入集群
 [root@sjz3 ~]# rabbitmqctl join_cluster --ram rabbit@sjz1
 #重新启动mq服务
 [root@sjz3 ~]# rabbitmqctl start_app
 
 #注://在另外其他节点上操作要移除的集群节点,和上面的命令正好相反
 rabbitmqctl forget_cluster_node rabbit@sjz1
  • 修改集群名称

 rabbitmqctl set_cluster_name rabbitmq_cluster1

2.5查看集群状态

[root@sjz2 ~]# rabbitmqctl cluster_status
Cluster status of node rabbit@sjz2 ...
Basics

Cluster name: rabbitmq_cluster1

Disk Nodes

rabbit@sjz1

RAM Nodes

rabbit@sjz2
rabbit@sjz3

Running Nodes

rabbit@sjz1
rabbit@sjz2
rabbit@sjz3

Versions

rabbit@sjz1: RabbitMQ 3.8.11 on Erlang 22.3
rabbit@sjz2: RabbitMQ 3.8.11 on Erlang 22.3
rabbit@sjz3: RabbitMQ 3.8.11 on Erlang 22.3

Maintenance status

Node: rabbit@sjz1, status: not under maintenance
Node: rabbit@sjz2, status: not under maintenance
Node: rabbit@sjz3, status: not under maintenance

Alarms

(none)

Network Partitions

(none)

Listeners

Node: rabbit@sjz1, interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communication
Node: rabbit@sjz1, interface: [::], port: 15672, protocol: http, purpose: HTTP API
Node: rabbit@sjz1, interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
Node: rabbit@sjz2, interface: [::], port: 15672, protocol: http, purpose: HTTP API
Node: rabbit@sjz2, interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communication
Node: rabbit@sjz2, interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
Node: rabbit@sjz3, interface: [::], port: 15672, protocol: http, purpose: HTTP API
Node: rabbit@sjz3, interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communication
Node: rabbit@sjz3, interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0

Feature flags

Flag: drop_unroutable_metric, state: enabled
Flag: empty_basic_get_metric, state: enabled
Flag: implicit_default_bindings, state: enabled
Flag: maintenance_mode_status, state: enabled
Flag: quorum_queue, state: enabled
Flag: user_limits, state: enabled
Flag: virtual_host_metadata, state: enabled

2.6访问管控台界面


3、配置镜像队列

3.1镜像队列思路

思路:
1.镜像集群只是在普通集群的基础上添加一些策略而已
2.设置镜像队列策略(在任意一个节点上执行)
3. ^ 表示同步全部,个性化策略根据需求而定

3.2策略执行

rabbitmqctl set_policy ha-all "^" '{"ha-mode":"all"}'

说明: 上面命令是将所有队列设置为镜像队列,即队列会被复制到各个节点,各个节点状态一致,RabbitMQ高可用集群就已经搭建好了,我们可以重启服务,查看其队列是否在从节点同步。

3.3登录管控台查看配置的策略



4、版本升级3.8.11-3.8.16

4.1 升级前思考

1、Rabbitmq如何升级

2、Rabbitmq版本升级,从什么版本升级到什么版本?

3、Erlang版本要求

4、版本之间的插件兼容性

5、不支持本地升级特性

6、新版本中系统资源使用和报告的变化

7、标记节点进行维护

8、注意事项

9、处理应用程序中的节点重新启动

4.2升级方案和升级策略

升级方案:单节点和集群,现场实际采用镜像集群

升级策略:

本地升级:其中每个节点都使用其现有的磁盘数据进行升级

蓝绿部署:创建新集群并将现有数据迁移其中

升级多个节点
根据升级中涉及的版本,RabbitMQ 集群 可能会使用称为滚动升级的过程提供在集群不停机的情况下执行升级的机会。
滚动升级是指节点一一停止、升级和重新启动,在升级每个节点时,集群的其余部分仍在运行。

如果无法进行滚动升级,则应停止整个集群,然后重新启动。这称为完全停止升级。

当每个节点停止时,客户端(应用程序)连接将被丢弃。应用程序需要准备好处理这个问题并重新连接。

滚动升级
滚动升级只能在兼容的 RabbitMQ 和 Erlang 版本之间进行。

「滚动升级只能在兼容的 RabbitMQ 和 Erlang 版本之间进行。」

本地升级:

本地升级通常涉及由部署工具执行或者工程师手动执行,简化的步骤清单如下:

  • 检查当前和目标版本是否有本地升级路径:

    • 检查版本可升级性

    • Erlang版本要求

    • 发行说明

    • 不支持本地升级的功能

    • 已知注意事项

  • 检查节点或集群是否处于良好状态以便升级:没有警报生成,没有正在进行的队列同步操作,系统是否处于合理负载下

  • 停止节点

  • 升级 RabbitMQ 和 Erlang(如果适用)

  • 启动节点

  • 监视监视和运行状态检查数据,以评估升级后的节点或群集的运行状况和恢复

蓝绿部署升级:

蓝/绿部署策略的好处是使升级过程更安全,但代价是临时增加基础设施占用空间。在安全方面,运营商

可以通过将应用程序切换回现有集群来中止升级。

4.3数据备份

每个 RabbitMQ 节点都有一个数据目录,用于存储驻留在该节点上的所有信息。

数据目录包含两种类型的数据:定义(元数据、模式/拓扑)和消息存储数据。

4.3.1元数据备份

节点和集群存储可以被认为是模式、元数据或拓扑的信息。用户、虚拟主机、队列、交换器、绑定、运行时参数都属于这一类。

元数据通常是静态的,而消息是不间断的从发布者流向消费者。

执行备份时,第一步是决定是只备份元数据还是同时备份消息存储。

因为消息通常是短暂的并且可能是暂时的,所以非常不鼓励从正在运行的节点下备份它们,这可能会导致数据快照不一致。

元数据只能从正在运行的节点备份。

  • 元数据导出

#要使用rabbitmqctl导出定义,请使用rabbitmqctl export_definitions:

# 不再允许管理插件,RabbitMQ 3.8.2 新增
rabbitmqctl export_definitions /path/to/definitions.file.json
[root@sjz1 tmp]# rabbitmqctl export_definitions /tmp/definitions.file.json
Exporting definitions in JSON to a file at "/tmp/definitions.file.json" ...
[root@sjz1 tmp]#
[root@sjz1 tmp]# ls
definitions.file.json hsperfdata_root systemd-private-c19b945494344ddb8fc79052d8f1a23d-chronyd.service-sGOq1S test.json
[root@sjz1 tmp]# cat definitions.file.json
{"bindings":[{"arguments":{},"destination":"admin","destination_type":"queue","routing_key":"admin","source":"admin","vhost":"/"},{"arguments":{},"destination":"test-ha-queue","destination_type":"queue","routing_key":"test","source":"test-ha","vhost":"/"}],"exchanges":[{"arguments":{},"auto_delete":false,"durable":true,"name":"admin","type":"direct","vhost":"/"},{"arguments":{},"auto_delete":false,"durable":true,"name":"test-ha","type":"direct","vhost":"/"}],"global_parameters":[{"name":"cluster_name","value":"rabbitmq_cluster1"}],"parameters":[],"permissions":[{"configure":".*","read":".*","user":"guest","vhost":"/","write":".*"},{"configure":".*","read":".*","user":"admin","vhost":"/","write":".*"}],"policies":[{"apply-to":"all","definition":{"ha-mode":"all"},"name":"ha-all","pattern":"^","priority":0,"vhost":"/"}],"queues":[{"arguments":{"x-queue-type":"classic"},"auto_delete":false,"durable":true,"name":"test-ha-queue","type":"classic","vhost":"/"},{"arguments":{"x-queue-type":"classic"},"auto_delete":false,"durable":true,"name":"haha","type":"classic","vhost":"/"},{"arguments":{"x-queue-type":"classic"},"auto_delete":false,"durable":true,"name":"admin","type":"classic","vhost":"/"}],"rabbit_version":"3.8.11","rabbitmq_version":"3.8.11","topic_permissions":[],"users":[{"hashing_algorithm":"rabbit_password_hashing_sha256","limits":{},"name":"admin","password_hash":"2LDsi3P/K8XRem3+kps+RYI7A76+9xSQ5wlTYg03cP5GP9A2","tags":"administrator"},{"hashing_algorithm":"rabbit_password_hashing_sha256","limits":{},"name":"guest","password_hash":"Ty4ymTsWpr7efwIR+iMAptDgTB8srP3orqf2fQhILaCc5Pti","tags":"administrator"}],"vhosts":[{"limits":[],"metadata":{"description":"Default virtual host","tags":[]},"name":"/"}]}[root@sjz1 tmp]#

#rabbitmqadmin 导出非常相似,但使用 HTTP API 并与旧版本兼容:

# 需要启用管理插件,该命令需要单独安装
rabbitmqadmin export /path/to/definitions.file.json
  • 元数据导入

#要使用rabbitmqctl导入定义,请使用rabbitmqctl import_definitions:

# 不再允许管理插件,RabbitMQ 3.8.2 新增
rabbitmqctl import_definitions /tmp/definitions.file.json
rabbitmqadmin import是它的 HTTP API 等价物:

# 需要启用管理插件
rabbitmqadmin 导入/tmp/definitions.file.json
也可以直接使用 HTTP API 端点。这是一个使用curl 和默认用户凭据联系localhost:15672 上的本地节点的示例:

curl -H "Accept:application/json" -u guest:guest "http://localhost:15672/api/definitions"

节点启动时的定义导入,高版本直接支持高清进口核心,而无需预先配置的管理插件。

要在节点启动时从本地文件导入定义,请将load_definitions配置键设置为先前导出的带有定义的 JSON 文件的路径:

# RabbitMQ 3.8.2 中的新功能。
# 不需要启用管理插件。
load_definitions = /path/to/definitions/file.json
从 RabbitMQ 3.8.6 开始,定义导入在插件激活后发生。这意味着可以在启动时导入与插件相关的定义(例如动态铲子、自定义类型的交换等)。

文件中的定义不会覆盖代理中已有的任何内容。但是,如果空白(未初始化)节点导入定义文件,则不会创建默认虚拟主机和用户。

节点启动后的定义导入
使用不提供内置定义导入的早期版本的安装可以在节点启动后立即使用两个 CLI 命令的组合导入定义:

# 等待启动最多 5 分钟
rabbitmqctl await_startup --timeout 300

# 使用rabbitmqctl 导入定义
rabbitmqctl import_definitions /path/to/definitions.file.json

# 或者,使用rabbitmqadmin 导入
# 需要启用管理插件
rabbitmqadmin 导入/path/to/definitions.file.json
  • 启动时导入,是在配置文件里写入如下内容


4.3.2消息数据备份

要在节点上备份消息,必须先停止它。

对于具有镜像队列的集群,需要停止整个集群以进行备份。如果一次停止一个节点,可能会丢失消息或有重复,就像备份单个运行节点时一样。

手动备份消息,目前这是备份消息的唯一方法。

在从 3.7.0 开始的 RabbitMQ 版本中,所有消息数据都组合在 msg_stores/vhosts目录中,并存储在每个 vhost 的子目录中。每个 vhost 目录都以哈希命名,并包含一个带有 vhost 名称的.vhost文件,因此可以单独备份特定 vhost 的消息集。

[root@sjz1 msg_stores]# cd vhosts/
[root@sjz1 vhosts]# ls
628WB79CIFDYO9LJI6DKMI09L
[root@sjz1 vhosts]#
[root@sjz1 vhosts]#
[root@sjz1 vhosts]# pwd
/usr/local/rabbitmq/var/lib/rabbitmq/mnesia/rabbit@sjz1/msg_stores/vhosts

在 3.7.0 之前的 RabbitMQ 版本中,消息存储在节点数据目录下的几个目录中:queues、msg_store_persistent和msg_store_transient。如果节点正常停止,还有一个recovery.dets文件,其中包含恢复元数据。

  • 消息数据恢复

当节点启动时,它将计算其数据目录位置并恢复消息。对于要恢复的消息,broker应该已经准备好所有元数据。未知虚拟主机和队列的消息数据将不会被加载并且可以被节点删除。因此,在手动备份消息目录时,通过定义文件导入或备份整个节点数据目录,确保目标节点(正在进行恢复的节点)上的元数据已经可用非常重要。

如果手动备份(复制)节点的数据目录,则该节点应以所有元数据和消息开始。无需先导入元数据。

4.4升级之前

  • 依据4.1升级前思考问题,确定升级策略和方式;

  • 根据思考问题,可知3.8.11到3.8.16版本,erlang版本存在不兼容,无法采用滚动升级的方式进行;

  • 只可以采用蓝绿升级,根据4.3中消息备份的阐述,现场为镜像集群,在需要数据的情况下,需要停止整个集群来进行备份,也就意味这可以叫做全面升级,全面升级有如下考虑点:

当整个集群停止升级时,节点停止和启动的顺序很重要。

在主要或次要版本之间升级时,RabbitMQ 会在必要时自动更新其数据目录。在集群中,此任务由要启动的第一个磁盘节点(“升级器”节点)执行。

因此,在使用“full stop”方法升级RabbitMQ集群时,必须先启动一个磁盘节点。首先启动 RAM 节点是行不通的:该节点将记录错误并停止。

在升级期间,最后一个关闭的磁盘节点必须是第一个启动的节点。否则启动的节点将发出错误消息并且无法启动。与普通集群重启不同,升级节点不会等待最后一个磁盘节点重新上线。

虽然不是绝对必要,但最好提前决定哪个磁盘节点将成为升级程序,最后停止该节点,然后首先启动它。否则,在升级程序节点停止和最后一个节点停止之间对集群配置所做的更改将丢失。
#请注意,在存在许多消息的情况下,节点可能需要几分钟才能完全关闭,因此如果节点响应 CLI 工具命令,它可能会执行各种关闭活动,例如将排队的消息移动到磁盘。

以下命令可用于验证节点是否遇到上述错误。执行以下基本命令时,受影响的节点将不会在合理的时间内响应 CLI 连接:
[root@sjz1 628WB79CIFDYO9LJI6DKMI09L]# rabbitmq-diagnostics ping
Will ping rabbit@sjz1. This only checks if the OS process is running and registered with epmd. Timeout: 60000 ms.
Ping succeeded
[root@sjz1 628WB79CIFDYO9LJI6DKMI09L]# rabbitmq-diagnostics status
Status of node rabbit@sjz1 ...
Runtime

OS PID: 28796
OS: Linux
Uptime (seconds): 1136780
Is under maintenance?: false
RabbitMQ version: 3.8.11
Node name: rabbit@sjz1
Erlang configuration: Erlang/OTP 22 [erts-10.7] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [hipe]
Erlang processes: 450 used, 1048576 limit
Scheduler run queue: 1
Cluster heartbeat timeout (net_ticktime): 60

Plugins

Enabled plugin file: /usr/local/rabbitmq/etc/rabbitmq/enabled_plugins
Enabled plugins:

* rabbitmq_management
* amqp_client
* rabbitmq_web_dispatch
* cowboy
* cowlib
* rabbitmq_management_agent

Data directory

Node data directory: /usr/local/rabbitmq/var/lib/rabbitmq/mnesia/rabbit@sjz1
Raft data directory: /usr/local/rabbitmq/var/lib/rabbitmq/mnesia/rabbit@sjz1/quorum/rabbit@sjz1

Config files

* /usr/local/rabbitmq/etc/rabbitmq/rabbitmq.conf

Log file(s)

* /usr/local/rabbitmq/var/log/rabbitmq/rabbit@sjz1.log
* /usr/local/rabbitmq/var/log/rabbitmq/rabbit@sjz1_upgrade.log

Alarms

(none)

Memory

Total memory used: 0.0957 gb
Calculation strategy: rss
Memory high watermark setting: 0.4 of available memory, computed to: 1.5293 gb

other_proc: 0.0333 gb (34.86 %)
code: 0.0273 gb (28.51 %)
other_system: 0.0134 gb (14.01 %)
plugins: 0.0065 gb (6.8 %)
allocated_unused: 0.0061 gb (6.36 %)
other_ets: 0.0034 gb (3.52 %)
reserved_unallocated: 0.0022 gb (2.25 %)
atom: 0.0016 gb (1.65 %)
binary: 0.0011 gb (1.14 %)
mgmt_db: 0.0003 gb (0.32 %)
metrics: 0.0002 gb (0.24 %)
mnesia: 0.0001 gb (0.13 %)
queue_procs: 0.0001 gb (0.07 %)
quorum_ets: 0.0 gb (0.05 %)
queue_slave_procs: 0.0 gb (0.04 %)
msg_index: 0.0 gb (0.03 %)
connection_other: 0.0 gb (0.01 %)
connection_channels: 0.0 gb (0.0 %)
connection_readers: 0.0 gb (0.0 %)
connection_writers: 0.0 gb (0.0 %)
quorum_queue_procs: 0.0 gb (0.0 %)

File Descriptors

Total: 3, limit: 65438
Sockets: 0, limit: 58892

Free Disk Space

Low free disk space watermark: 0.05 gb
Free disk space: 35.7929 gb

Totals

Connection count: 0
Queue count: 3
Virtual host count: 1

Listeners

Interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communication
Interface: [::], port: 15672, protocol: http, purpose: HTTP API
Interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
  • 核查镜像队列同步

# 如果目标节点拥有至少一个队列的领导者副本,则以非零代码退出
# 有不同步的镜像。
rabbitmq-diagnostics check_if_node_is_mirror_sync_critical
[root@sjz1 628WB79CIFDYO9LJI6DKMI09L]# rabbitmq-diagnostics check_if_node_is_mirror_sync_critical
Checking if node rabbit@sjz1 is critical for data safety of any classic mirrored queues ...
Node rabbit@sjz1 reported no classic mirrored queues without online synchronised mirrors
  • 可以通过在管理 UI 中列出队列或使用rabbitmqctl来验证经典镜像队列副本状态:

# 对于非空`slave_pids`的队列,你必须至少有一个
# `synchronised_slave_pids`。
rabbitmqctl -n rabbit@to-be-stopped list_queues --local name slave_pids synchronised_slave_pids
要查看镜像状态(是否同步),请使用:

rabbitmqctl list_queues name slave_pids synchronised_slave_pids
可以手动同步队列:

rabbitmqctl sync_queue {name}
或者取消正在进行的同步:

rabbitmqctl cancel_sync_queue {name}
  • 镜像队列leader重分配

某些升级方案可能会导致镜像队列领导者在集群中的节点之间分布不均。这将给具有更多队列领导者的节点带来更多负载。例如,完全停止升级将使所有队列领导者迁移到“升级者”节点 - 最后停止并首先启动的节点。带有两个镜像的三个节点的滚动升级也会导致所有队列领导者都在同一个节点上。

可以使用带有 ha-mode: nodes和ha-params: [<node>] 的临时策略移动队列的队列领导者:该策略可以通过管理 UI 或 rabbitmqctl 命令创建:
rabbitmqctl set_policy --apply-to queues --priority 100 move-my-queue '^<queue>$;' '{"ha-mode":"nodes", "ha-params":["<new-master-node>"]}'
rabbitmqctl clear_policy move-my-queue

4.5升级时

1、根据上文中的安装方式,在新的服务器上搭建一套新的rabbitmq集群,主机名、集群名和原集群保持一致;

[root@sjz3 ~]# rabbitmqctl cluster_status
Cluster status of node rabbit@sjz3 ...
Basics

Cluster name: rabbitmq_cluster1

Disk Nodes

rabbit@sjz1

RAM Nodes

rabbit@sjz2
rabbit@sjz3

Running Nodes

rabbit@sjz1
rabbit@sjz2
rabbit@sjz3

Versions

rabbit@sjz1: RabbitMQ 3.8.16 on Erlang 23.2
rabbit@sjz2: RabbitMQ 3.8.16 on Erlang 23.2
rabbit@sjz3: RabbitMQ 3.8.16 on Erlang 23.2

Maintenance status

Node: rabbit@sjz1, status: not under maintenance
Node: rabbit@sjz2, status: not under maintenance
Node: rabbit@sjz3, status: not under maintenance

Alarms

(none)

Network Partitions

(none)

Listeners

Node: rabbit@sjz1, interface: [::], port: 15672, protocol: http, purpose: HTTP API
Node: rabbit@sjz1, interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communication
Node: rabbit@sjz1, interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
Node: rabbit@sjz2, interface: [::], port: 15672, protocol: http, purpose: HTTP API
Node: rabbit@sjz2, interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communication
Node: rabbit@sjz2, interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
Node: rabbit@sjz3, interface: [::], port: 15672, protocol: http, purpose: HTTP API
Node: rabbit@sjz3, interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communication
Node: rabbit@sjz3, interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0

Feature flags

Flag: drop_unroutable_metric, state: enabled
Flag: empty_basic_get_metric, state: enabled
Flag: implicit_default_bindings, state: enabled
Flag: maintenance_mode_status, state: enabled
Flag: quorum_queue, state: enabled
Flag: user_limits, state: enabled
Flag: virtual_host_metadata, state: enabled
[root@sjz3 ~]# clear
[root@sjz3 ~]#
[root@sjz3 ~]#
[root@sjz3 ~]# rabbitmqctl cluster_status
Cluster status of node rabbit@sjz3 ...
Basics

Cluster name: rabbitmq_cluster1

Disk Nodes

rabbit@sjz1

RAM Nodes

rabbit@sjz2
rabbit@sjz3

Running Nodes

rabbit@sjz1
rabbit@sjz2
rabbit@sjz3

Versions

rabbit@sjz1: RabbitMQ 3.8.16 on Erlang 23.2
rabbit@sjz2: RabbitMQ 3.8.16 on Erlang 23.2
rabbit@sjz3: RabbitMQ 3.8.16 on Erlang 23.2

Maintenance status

Node: rabbit@sjz1, status: not under maintenance
Node: rabbit@sjz2, status: not under maintenance
Node: rabbit@sjz3, status: not under maintenance

Alarms

(none)

Network Partitions

(none)

Listeners

Node: rabbit@sjz1, interface: [::], port: 15672, protocol: http, purpose: HTTP API
Node: rabbit@sjz1, interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communication
Node: rabbit@sjz1, interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
Node: rabbit@sjz2, interface: [::], port: 15672, protocol: http, purpose: HTTP API
Node: rabbit@sjz2, interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communication
Node: rabbit@sjz2, interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
Node: rabbit@sjz3, interface: [::], port: 15672, protocol: http, purpose: HTTP API
Node: rabbit@sjz3, interface: [::], port: 25672, protocol: clustering, purpose: inter-node and CLI tool communication
Node: rabbit@sjz3, interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0

Feature flags

Flag: drop_unroutable_metric, state: enabled
Flag: empty_basic_get_metric, state: enabled
Flag: implicit_default_bindings, state: enabled
Flag: maintenance_mode_status, state: enabled
Flag: quorum_queue, state: enabled
Flag: user_limits, state: enabled
Flag: virtual_host_metadata, state: enabled

2、关停旧版本rabbitmq集群,保证最后一个关闭的是disk节点;


[root@sjz2 ~]# rabbitmqctl stop_app
Stopping rabbit application on node rabbit@sjz2 ...
[root@sjz3 ~]# rabbitmqctl stop_app
Stopping rabbit application on node rabbit@sjz3 ...


[root@sjz1 software]# rabbitmqctl stop_app
Stopping rabbit application on node rabbit@sjz1 ...

3、备份旧版本集群中的数据目录和配置文件目录;

[root@sjz1 rabbitmq]# tar -czvf mnesia.tar.gz mnesia/
[root@sjz1 rabbitmq]# ls
mnesia mnesia.tar.gz

4、数据目录和配置文件目录传输到新服务器中;三个服务器都要替换

[root@sjz1 ~]# pwd
/root
[root@sjz1 ~]# ls
anaconda-ks.cfg initial-setup-ks.cfg mnesia.tar.gz

5、修改配置文件中的关于ip或者目录位置的配置项;

6、启动新版本rabbitmq;

[root@sjz1 mnesia]# rabbitmqctl start_app
Starting node rabbit@sjz1 ...
[root@sjz1 mnesia]# lsof -i :5672
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
beam.smp 41213 root 98u IPv6 796479 0t0 TCP *:amqp (LISTEN)
[root@sjz2 rabbitmq]# rabbitmqctl start_app
Starting node rabbit@sjz2 ...
[root@sjz3 ~]# rabbitmqctl start_app
Starting node rabbit@sjz3 ...

7、验证升级是否成功;

  • 服务启动正常




减少关停时间,可以将conf目录和修改内容,提前传输和修改

最后修改时间:2023-02-03 15:10:45
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论