这里打算移除rabbit@rabbitmq-03。
① 首先将要移除的节点停机
root@rabbitmq-03 ~]# rabbitmqctl stop
Stopping and halting node ‘rabbit@rabbitmq-03’ …
② 在集群的其他节点上移除要下线的节点
root@rabbitmq-01 ~]# rabbitmqctlforget_cluster_node rabbit@rabbitmq-03
Removing node ‘rabbit@rabbitmq-03’ from cluster …
③ 验证
#查看集群状态信息.
root@rabbitmq-01 ~]# rabbitmqctl cluster_status
Cluster status of node ‘rabbit@rabbitmq-01’ …
[{nodes,[{disc,[‘rabbit@rabbitmq-01’,‘rabbit@rabbitmq-02’]}]},
{running_nodes,[‘rabbit@rabbitmq-02’,‘rabbit@rabbitmq-01’]},
{cluster_name,<<“rabbit@rabbitmq-01”>>},
{partitions,[]}]
发现rabbitmq3节点已经被移除.
#在之前被剔除集群的节点上操作
mv /var/lib/rabbitmq/mnesia/* /tmp/
systemctl start rabbitmq-server
rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl join_cluster 集群中正常节点名称
rabbitmqctl start_app
rabbitmqctl cluster_status