一 实验环境
二 实验步骤
2.1 安装单实例RabbitMQ
可参考:https://blog.csdn.net/yabingshi_tech/article/details/109401943
2.2 修改两台服务器的/etc/hosts文件
添加:
192.168.144.204 pc1
192.168.144.208 pc2
2.3 拷贝节点一的.erlang.cookie文件到node-2节点
[[email protected] ~]# scp /var/lib/rabbitmq/.erlang.cookie 192.168.144.208:/var/lib/rabbitmq/
[[email protected] ~]# chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/.erlang.cookie
2.4 将pc2与pc1组成集群
在第二个节点上执行:
[[email protected] ~]# rabbitmqctl stop_app
Stopping rabbit application on node [email protected] ...
[[email protected] ~]# rabbitmqctl reset
Resetting node [email protected] ...
[[email protected] ~]# rabbitmqctl join_cluster [email protected]
Clustering node [email protected] with [email protected]
[[email protected] ~]# rabbitmqctl start_app
Starting node [email protected] ...
completed with 3 plugins.
[[email protected] ~]# rabbitmqctl cluster_status
Cluster status of node [email protected] ...
[{nodes,[{disc,[[email protected],[email protected]]}]},
{running_nodes,[[email protected],[email protected]]},
{cluster_name,<<"[email protected]">>},
{partitions,[]},
{alarms,[{[email protected],[]},{[email protected],[]}]}]
进管理界面查看节点: