RabbitMQ集群(单机多实例部署)
RabbitMQ集群一、单机多实例部署单机版安装地址:RabbitMQ3.8.4安装和配置在单机版基础上 ,也就是一台Linux虚拟机上启动多个RabbitMQ实例,部署集群。1. 在单个Linux虚拟机上运行多个RabbitMQ实例:多个RabbitMQ使用的端口号不能冲突多个RabbitMQ使用的磁盘存储路径不能冲突多个RabbitMQ的配置文件也不能冲突在单个Linux虚拟机上运行多个Rab
RabbitMQ集群(单机多实例部署)
一、单机多实例部署
单机版安装地址:RabbitMQ3.8.4安装和配置
在单机版基础上 ,也就是一台Linux虚拟机上启动多个RabbitMQ实例,部署集群。
1. 在单个Linux虚拟机上运行多个RabbitMQ实例:
- 多个RabbitMQ使用的 端口 号不能冲突
- 多个RabbitMQ使用的磁盘 存储路径 不能冲突
- 多个RabbitMQ的 配置文 件也不能冲突
说明:
在单个Linux虚拟机上运行多个RabbitMQ实例,涉及到RabbitMQ虚拟 主机的名称 不能重复,每个RabbitMQ使用的 端口 不能重复。
RABBITMQ_NODE_PORT :用于设置RabbitMQ的服务发现,对外发布的其他端口在这个端口基础上计算得来。(指定5672端口)
1.1 端口介绍
端口号 | 说明 |
---|---|
4369 | epmd,RabbitMQ节点和CLI工具使用的对等发现服务 |
5672、5671 | 分别为不带TLS和带TLS的AMQP 0-9-1和1.0客户端使用 |
25672 | 用于节点间和CLI工具通信(Erlang分发服务器端口),并从动态范围分配(默认情况下限制为单个端口,计算为AMQP端口+ 20000)。一般这些端口不应暴露出去。 |
35672-35682 | 由CLI工具(Erlang分发客户端端口)用于与节点进行通信,并从动态范围(计算为服务器分发端口+ 10000通过服务器分发端口+ 10010)分配。 |
15672 | HTTP API客户端,管理UI和Rabbitmqadmin(仅在启用了管理插件的情况下) |
61613、61614 | 不带TLS和带TLS的STOMP客户端(仅在启用STOMP插件的情况下) |
1883、8883 | 如果启用了MQTT插件,则不带TLS和具有TLS的MQTT客户端 |
15674 | STOMP-over-WebSockets客户端(仅在启用了Web STOMP插件的情况下) |
15675 | MQTT-over-WebSockets客户端(仅在启用Web MQTT插件的情况下) |
15692 | Prometheus指标(仅在启用Prometheus插件的情况下) |
RABBITMQ_NODENAME :用于设置RabbitMQ节点名称, @ 前缀是用户名, @ 后缀是RabbitMQ所在的Linux主机的 hostname 。
通 常:在同一台服务器上,运行多个rabbitmq实例,只要变更5672端口即可。
1.2 数据存储目录:
通过修改RABBITMQ_NODENAME属性的值,可以修改数据存储和日志存储目录
1.3 日志数据存储目录:
RabbitMQ使用的环境变量:
环境变量 | 说明 |
---|---|
RABBITMQ_NODE_IP_ADDRESS | 将RabbitMQ绑定到一个网络接口。 如果要绑定多个网络接口,可以在配置文件中配置。 默认值:空字串。表示绑定到所有的网络接口。 |
RABBITMQ_NODE_PORT | 默认值:5672 |
RABBITMQ_DIST_PORT | RabbitMQ节点之间通信以及节点和CLI工具通信用到的端口。 如果在配置文件中配置了kernel.inet_dist_listen_min 或者kernel.inet_dist_listen_max,则忽略该配置。 默认值:$RABBITMQ_NODE_PORT + 20000 |
ERL_EPMD_ADDRESS | epmd 使用的网络接口, epmd 用于节点之间以及节点和CLI之间的通信。 默认值:所有网络接口,包括和IPv4。 |
ERL_EPMD_PORT | epmd 使用的端口。 默认值:4369。 |
RABBITMQ_DISTRIBUTION_BUFFER_SIZE | 节点之间通信连接使用的发送数据缓冲区大小限制, 单位是KB。推荐使用小于64MB的值。 默认值:128000。 |
RABBITMQ_IO_THREAD_POOL_SIZE | Erlang运行时的 I/O 用到的线程数。不推荐小于32的值。 默认值:128(Linux),64(Windows) |
RABBITMQ_NODENAME | RabbitMQ的节点名称。对于Erlang节点和机器,此名称应该唯一。 通过设置此值,可以在一台机器上多个RabbitMQ节点。 默认值:rabbit@$HOSTNAME(Unix-like),rabbit@%COMPUTERNAME%(Windows)。 |
RABBITMQ_CONFIG_FILE | RabbitMQ主要配置文件的路径。例如 /etc/rabbitmq/rabbitmq.conf 或者 /data/configuration/rabbitmq.conf 是新格式的配置文件。 如果是老格式的配置文件,扩展名是 .config 或者不写。 默认值: 对于Unix: R A B B I T M Q H O M E / e t c / r a b b i t m q / r a b b i t m q D e b i a n : / e t c / r a b b i t m q / r a b b i t m q R P M : / e t c / r a b b i t m q / r a b b i t m q M a c O S ( H o m e b r e w ) : RABBITMQ_HOME/etc/rabbitmq/rabbitmq Debian:/etc/rabbitmq/rabbitmq RPM: /etc/rabbitmq/rabbitmq MacOS(Homebrew): RABBITMQHOME/etc/rabbitmq/rabbitmqDebian:/etc/rabbitmq/rabbitmqRPM:/etc/rabbitmq/rabbitmqMacOS(Homebrew):{install_prefix}/etc/rabbitmq/rabbitmq , Homebrew的前缀通常是: /usr/local/ Windo%APPDATA%\RabbitMQ\rabbitmq |
RABBITMQ_ADVANCED_CONFIG_FILE | RabbitMQ带 .config 的高级配置文件路径(基于Erlang配置)。例如, /data/rabbitmq/advanced.config 。默认值:Unix: $RABBITMQ_HOME/etc/rabbitmq/advanced Debian: /etc/rabbitmq/advanced RPM: /etc/rabbitmq/advanced MacOS(Homebrew): ${install_prefix}/etc/rabbitmq/advanced , 其中Homebrew前缀通常是 /etc/local/Windows: %APPDATA%\RabbitMQ\advanced 。 |
RABBITMQ_CONF_ENV_FILE | 包含了环境变量定义的文件的目录(不使用 RABBITMQ_ 前缀)。 Windows上的文件名称与其他操作系同。 默认值: UNIX: $RABBITMQ_HOME/etc/rabbitmq/rabbitmq-env.conf Ubuntu和Debian: /etc/rabbitmq/rabbitmq-env.conf RPM: /etc/rabbitmq/rabbitmq-env.conf Mac (Homebrew): ${install_prefix}/etc/rabbitmq/rabbitmq-env.conf ,Homebrew的前缀一般是 /usr/local Windows: %APPDATA%\RabbitMQ\rabbitmq-env-conf.bat |
RABBITMQ_MNESIA_DIR | RabbitMQ节点存储数据的目录。该目录中包含了数据库、 消息存储、集群成员信息以及节点其他的持状态。 默认值: 通用UNIX包: R A B B I T M Q M N E S I A B A S E / RABBITMQ_MNESIA_BASE/ RABBITMQMNESIABASE/RABBITMQ_NODENAME Ubuntu和Debia R A B B I T M Q M N E S I A B A S E / RABBITMQ_MNESIA_BASE/ RABBITMQMNESIABASE/RABBITMQ_NODENAME RPM: R A B B I T M Q M N E S I A B A S E / RABBITMQ_MNESIA_BASE/ RABBITMQMNESIABASE/RABBITMQ_NO MacOS (Homebrew): i n s t a l l p r e f i x / v a r / l i b / r a b b i t m q / m n e s i a / {install_prefix}/var/lib/rabbitmq/mnesia/ installprefix/var/lib/rabbitmq/mnesia/RABBITMQ_NODENAME , Homebrew的前缀一般是 /usr/local Windows: %APPDATA%\RabbitMQ$RABBITMQ_NODENAME |
RABBITMQ_PLUGINS_DIR | 存放插件压缩文件的目录。RabbitMQ从此目录解压插件。 跟PATH变量语法类似,多个路径之间使用统的分隔符分隔 (Unix是 : ,Windows是’;')。插件可以安装到该变量指定的任何目录。 路径不要有符。 默认值: 通用UNIX包: R A B B I T M Q H O M E / p l u g i n s U b u n t u 和 D e b i a n 包: / v a r / l i b / r a b b i t m q / p l u g i n s R P M : / v a r / l i b / r a b b i t m q / p l u g i n s M a c O S ( H o m e b r e w ) : RABBITMQ_HOME/plugins Ubuntu和Debian包: /var/lib/rabbitmq/plugins RPM: /var/lib/rabbitmq/plugins MacOS (Homebrew): RABBITMQHOME/pluginsUbuntu和Debian包:/var/lib/rabbitmq/pluginsRPM:/var/lib/rabbitmq/pluginsMacOS(Homebrew):{install_prefix}/Cellar/rabbitmq/${version}/plugins , Homebrew的前缀一般是 /usr/ Windows: %RABBITMQ_HOME%\plugins |
RABBITMQ_PLUGINS_EXPAND_DIR | 节点解压插件的目录,并将该目录添加到代码路径。该路径不要包含特殊字符。 默认值: UNIX: R A B B I T M Q M N E S I A B A S E / RABBITMQ_MNESIA_BASE/ RABBITMQMNESIABASE/RABBITMQ_NODENAME-plugins-expand Ubuntu和Debian packages: R A B B I T M Q M N E S I A B A S E / RABBITMQ_MNESIA_BASE/ RABBITMQMNESIABASE/RABBITMQ_NODENAME-plugins-expand RPM: R A B B I T M Q M N E S I A B A S E / RABBITMQ_MNESIA_BASE/ RABBITMQMNESIABASE/RABBITMQ_NODENAME-plugins-expand MacOS (Homebrew): i n s t a l l p r e f i x / v a r / l i b / r a b b i t m q / m n e s i a / {install_prefix}/var/lib/rabbitmq/mnesia/ installprefix/var/lib/rabbitmq/mnesia/RABBITMQ_NODENAME-plugins-expand Window%APPDATA%\RabbitMQ$RABBITMQ_NODENAME-plugins-expand |
RABBITMQ_USE_LONGNAME | 当设置为 true 的时候,RabbitMQ会使用全限定主机名标记节点。 在使用全限定域名的环境中使用。重置节点, 不能在全限定主机名和短名之间切换。 默认值: false 。 |
RABBITMQ_SERVER_CODE_PATH | 当启用运行时的时候指定的外部代码路径(目录)。 当节点启动的时候,这个是值传给 erl 的命令行默认值:(none) |
RABBITMQ_CTL_ERL_ARGS | 当调用 rabbitmqctl 的时候传给 erl 的命令行参数。 可以给Erlang设置使用端口的范围: -kernel inet_dist_listen_min 35672 -kernel inet_dist_listen_max 35680 默认值:(none) |
RABBITMQ_SERVER_ERL_ARGS | 当调用RabbitMQ服务器的时候 erl 的标准命令行参数。 仅用于测试目的。使用该环境变量会覆盖默认默认值: Unix*: +P 1048576 +t 5000000 + stbt db +zdbbl 128000 Windows:没有 |
RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS | 调用RabbitMQ服务器的时候传递给 erl 命令的额外参数。 该变量指定的变量追加到默认参数列表( RABBITMQ_SERVER_ERL_ARGS )。 默认值: Unix*: 没有 Windows: 没有 |
RABBITMQ_SERVER_START_ARGS | 调用RabbitMQ服务器的时候传给 erl 命令的额外参数。该变量不覆盖 RABBITMQ_SERVER_ERL_ARGS默认值:没有 |
RABBITMQ_ENABLED_PLUGINS_FILE | 用于指定 enabled_plugins 文件所在的位置。默认: /etc/rabbitmq/enabled_plugins |
1.4 启动多个rabbitmq实例,方式一:通过设置环境变量
启动节点一:
export RABBITMQ_NODE_PORT=5672
export RABBITMQ_NODENAME=rabbit2
rabbitmq-server
启动节点二:
export RABBITMQ_NODE_PORT=5673
export RABBITMQ_NODENAME=rabbit3
rabbitmq-server
启动节点:三
export RABBITMQ_NODE_PORT=5674
export RABBITMQ_NODENAME=rabbit4
rabbitmq-server
测试
查看当前启动的节点状态信息:
[root@RabbitMQ ~]# rabbitmqctl --node rabbit1@RabbitMQ status
Status of node rabbit1@RabbitMQ ...
Runtime
OS PID: 8675
OS: Linux
Uptime (seconds): 171
RabbitMQ version: 3.8.5
Node name: rabbit1@RabbitMQ
Erlang configuration: Erlang/OTP 23 [erts-11.0.2] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:64] [hipe]
Erlang processes: 440 used, 1048576 limit
Scheduler run queue: 1
Cluster heartbeat timeout (net_ticktime): 60
Plugins
Enabled plugin file: /etc/rabbitmq/enabled_plugins
Enabled plugins:
* rabbitmq_management
* amqp_client
* rabbitmq_web_dispatch
* cowboy
* cowlib
* rabbitmq_management_agent
Data directory
Node data directory: /var/lib/rabbitmq/mnesia/rabbit1@RabbitMQ
Raft data directory: /var/lib/rabbitmq/mnesia/rabbit1@RabbitMQ/quorum/rabbit1@RabbitMQ
Config files
* /etc/rabbitmq/rabbitmq.conf
Log file(s)
* /var/log/rabbitmq/rabbit1@RabbitMQ.log
* /var/log/rabbitmq/rabbit1@RabbitMQ_upgrade.log
Alarms
(none)
Memory
Calculation strategy: rss
Memory high watermark setting: 0.4 of available memory, computed to: 0.4079 gb
other_proc: 0.0329 gb (33.46 %)
code: 0.0277 gb (28.14 %)
other_system: 0.0123 gb (12.46 %)
allocated_unused: 0.0117 gb (11.92 %)
plugins: 0.0086 gb (8.7 %)
other_ets: 0.0032 gb (3.24 %)
atom: 0.0014 gb (1.44 %)
mgmt_db: 0.0003 gb (0.27 %)
binary: 0.0001 gb (0.14 %)
mnesia: 0.0001 gb (0.08 %)
metrics: 0.0001 gb (0.06 %)
connection_other: 0.0 gb (0.05 %)
msg_index: 0.0 gb (0.03 %)
quorum_ets: 0.0 gb (0.02 %)
connection_channels: 0.0 gb (0.0 %)
connection_readers: 0.0 gb (0.0 %)
connection_writers: 0.0 gb (0.0 %)
queue_procs: 0.0 gb (0.0 %)
queue_slave_procs: 0.0 gb (0.0 %)
quorum_queue_procs: 0.0 gb (0.0 %)
reserved_unallocated: 0.0 gb (0.0 %)
File Descriptors
Total: 2, limit: 927
Sockets: 0, limit: 832
Free Disk Space
Low free disk space watermark: 0.05 gb
Free disk space: 14.6768 gb
Totals
Connection count: 0
Queue count: 0
Virtual host count: 1
Listeners
Interface: [::], port: 25673, protocol: clustering, purpose: inter-node and CLI tool communication
Interface: [::], port: 5673, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
Interface: [::], port: 15672, protocol: http, purpose: HTTP API
查看节点的端口信息:
1.5 启动多个rabbitmq实例,方式二:执行命令指定参数
RABBITMQ_NODE_PORT=5672 RABBITMQ_NODENAME=rabbit2 rabbitmq-server
RABBITMQ_NODE_PORT=5673 RABBITMQ_NODENAME=rabbit3 rabbitmq-server
RABBITMQ_NODE_PORT=5674 RABBITMQ_NODENAME=rabbit4 rabbitmq-server
以上命令的运行主要考虑到环境变量的可见性问题。
2. 启动web控制台的管理插件
例如:web控制台使用的端口都是15672,多个rabbitmq实例需要进行区分
rabbitmq-plugins enable rabbitmq_management
rabbitmq从3.3.0开始禁止使用guest/guest权限通过除localhost外的访问。
如果想使用guest/guest通过远程机器访问,需要在rabbitmq配置文件中设置loopback_users为[],当然也可以按我之前讲的命令自己创建用户。
2.1 修改配置文件的方式:使用guest/guest通过远程机器访问
默认配置文件的位置:/etc/rabbitmq/rabbitmq.conf
vim /etc/rabbitmq/rabbitmq.conf
测试:
rabbitmq配置参数建议参考官方源码包中的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.
##
# 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
# 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
## 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 default AMQP 0-9-1 heartbeat interval (in seconds).
## 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
## 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
## ----------------------------------------------------------------------------
## 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
# management.ssl.client_renegotiation = false
# management.ssl.secure_renegotiate = true
## Supported TLS versions
# management.ssl.versions.1 = tlsv1.2
# management.ssl.versions.2 = tlsv1.1
## 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, []}
# ]},
# -----------------------------
2.2 自定义配置文件,不使用默认配置文件
注意:如果要使用自定义位置的配置文件,需要目录属于 rabbitmq 组。
我们在/opt/rabbitconf中创建三个配置文件:
rabbit1.conf
rabbit2.conf
rabbit3.conf
其中注明三个RabbitMQ实例使用的rabbitmq_management插件使用的端口号,以及开通guest远程登录系统的权限:
文件路径 | 内容 |
---|---|
/opt/rabbitmqconf/rabbit1.conf | loopback_users.guest=false management.tcp.port=6001 |
/opt/rabbitmqconf/rabbit2.conf | loopback_users.guest=false management.tcp.port=6002 |
/opt/rabbitmqconf/rabbit2.conf | loopback_users.guest=false management.tcp.port=6003 |
创建配置文件目录和配置文件
修改配置文件,设置插件占用端口
启动rabbitmq实例1,设置端口和文件
启动rabbitmq其他实例,设置端口和文件
2.3 启动命令:
节点名称 | 命令 |
---|---|
rabbit1 | RABBITMQ_NODENAME=rabbit1 RABBITMQ_NODE_PORT=5001 RABBITMQ_CONFIG_FILE=/opt/rabbitconf/rabbit1.conf rabbitmq-server |
rabbit2 | RABBITMQ_NODENAME=rabbit1 RABBITMQ_NODE_PORT=5001 RABBITMQ_CONFIG_FILE=/opt/rabbitconf/rabbit1.conf rabbitmq-server |
rabbit3 | RABBITMQ_NODENAME=rabbit1 RABBITMQ_NODE_PORT=5001 RABBITMQ_CONFIG_FILE=/opt/rabbitconf/rabbit1.conf rabbitmq-server |
2.4 停止命令:
节点名称 | 命令 |
---|---|
rabbit1 | rabbitmqctl -n rabbit1 stop |
rabbit2 | rabbitmqctl -n rabbit2 stop |
rabbit3 | rabbitmqctl -n rabbit3 stop |
更多推荐
所有评论(0)