1.准备3台虚拟机:
192.168.10.21 rabbit-a 内存节点
192.168.10.22 rabbit-b 磁盘节点
192.168.10.23 rabbit-c 磁盘节点
2.安装RabbitMQ 参考 https://blog.csdn.net/AnY11/article/details/82916839
3.修改三台机子的/etc/hosts,加入如下内容:
192.168.10.21 rabbit-a
192.168.10.22 rabbit-b
192.168.10.23 rabbit-c
4.复制rabbit-b的cookie文件到 rabbit-a rabbit-c
scp /var/lib/rabbitmq/.erlang.cookie root@rabbit-a:/var/lib/rabbitmq/
scp /var/lib/rabbitmq/.erlang.cookie root@rabbit-c:/var/lib/rabbitmq/
5.rabbit-a执行如下命令:
rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl join_cluster --ram rabbit@rabbit-b
rabbitmqctl start_app
6.rabbit-c执行如下命令:
rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl join_cluster rabbit@rabbit-b
rabbitmqctl start_app
7.任意一台执行命令:
rabbitmqctl cluster_status