rabbit2
[root@hiddenzhu-8drdc rabbitmq]# rabbitmqctl -n rabbit2 stop_app Stopping node 'rabbit2@hiddenzhu-8drdc' ... ...done. [root@hiddenzhu-8drdc rabbitmq]# rabbitmqctl -n rabbit2 reset Resetting node 'rabbit2@hiddenzhu-8drdc' ... ...done. [root@hiddenzhu-8drdc rabbitmq]# rabbitmqctl -n rabbit2 cluster rabbit1@`hostname -s` Clustering node 'rabbit2@hiddenzhu-8drdc' with ['rabbit1@hiddenzhu-8drdc'] ... ...done. [root@hiddenzhu-8drdc rabbitmq]# rabbitmqctl -n rabbit2 start_app Starting node 'rabbit2@hiddenzhu-8drdc' ... ...done.TIPS
如果略去“rabbitmqctl -n rabbit2 reset”这一句,可能会报错:
查看cluster信息
[root@hiddenzhu-8drdc rabbitmq]# rabbitmqctl -n rabbit1 cluster_status Cluster status of node 'rabbit1@hiddenzhu-8drdc' ... [{nodes,[{disc,['rabbit1@hiddenzhu-8drdc']}, {ram,['rabbit2@hiddenzhu-8drdc']}]}, {running_nodes,['rabbit2@hiddenzhu-8drdc','rabbit1@hiddenzhu-8drdc']}] ...done. [root@hiddenzhu-8drdc rabbitmq]# rabbitmqctl -n rabbit2 cluster_status Cluster status of node 'rabbit2@hiddenzhu-8drdc' ... [{nodes,[{disc,['rabbit1@hiddenzhu-8drdc']}, {ram,['rabbit2@hiddenzhu-8drdc']}]}, {running_nodes,['rabbit1@hiddenzhu-8drdc','rabbit2@hiddenzhu-8drdc']}] ...done.加入节点rabbit3
[root@hiddenzhu-8drdc rabbitmq]# RABBITMQ_NODE_PORT=5674 RABBITMQ_NODENAME=rabbit3 rabbitmq-server -detached Activating RabbitMQ plugins ... 0 plugins activated: [root@hiddenzhu-8drdc rabbitmq]# rabbitmqctl -n rabbit3 stop_app Stopping node 'rabbit3@hiddenzhu-8drdc' ... ...done. [root@hiddenzhu-8drdc rabbitmq]# rabbitmqctl -n rabbit3 reset Resetting node 'rabbit3@hiddenzhu-8drdc' ... ...done. [root@hiddenzhu-8drdc rabbitmq]# rabbitmqctl -n rabbit3 cluster rabbit1@`hostname -s` Clustering node 'rabbit3@hiddenzhu-8drdc' with ['rabbit1@hiddenzhu-8drdc'] ... ...done. [root@hiddenzhu-8drdc rabbitmq]# rabbitmqctl -n rabbit3 start_app Starting node 'rabbit3@hiddenzhu-8drdc' ... ...done.最终查看集群状态
[root@hiddenzhu-8drdc rabbitmq]# rabbitmqctl -n rabbit3 cluster_status Cluster status of node 'rabbit3@hiddenzhu-8drdc' ... [{nodes,[{disc,['rabbit1@hiddenzhu-8drdc']}, {ram,['rabbit3@hiddenzhu-8drdc','rabbit2@hiddenzhu-8drdc']}]}, {running_nodes,['rabbit1@hiddenzhu-8drdc','rabbit2@hiddenzhu-8drdc', 'rabbit3@hiddenzhu-8drdc']}] ...done.TIPS
有可能遇到这样的情况:
有一种解决版本是将“/var/lib/rabbitmq/mnesia/”目录下的所有内容删掉(rm -rf *),然后重新启动再配置。
And….
很多时候也会遇到这样的情况:
这说明rabbitmq节点并未启动起来,需要进一步查看排除异常。
End…
CentOS 7.2 下 RabbitMQ 集群搭建