RabbitMQ集群I11

2022-05-04 22:00:55 浏览数 (1)

远程剔除

有些不响应的node,一段时间里无法交互,可以远程的方式,从集群中剔除

停掉h101上应用,模拟不响应

代码语言:javascript复制
[root@h101 ~]# rabbitmqctl stop_app
Stopping node rabbit@h101 ...
[root@h101 ~]# 

从h102上对h101进行剔除

代码语言:javascript复制
[root@h102 ~]# rabbitmqctl forget_cluster_node rabbit@h101
Removing node rabbit@h101 from cluster ...
[root@h102 ~]# 

此时h102上信息已经一致了,但是h101还认为自己是集群的一部分,一旦它的应用恢复,它会尝试与集群联络,从而产生报错

代码语言:javascript复制
[root@h101 ~]# rabbitmqctl start_app
Starting node rabbit@h101 ...


BOOT FAILED
===========

Error description:
   {error,{inconsistent_cluster,"Node rabbit@h101 thinks it's clustered with node rabbit@h102, but rabbit@h102 disagrees"}}

Log files (may contain more information):
   /var/log/rabbitmq/rabbit@h101.log
   /var/log/rabbitmq/rabbit@h101-sasl.log

Stack trace:
   [{rabbit_mnesia,check_cluster_consistency,0},
    {rabbit,'-start/0-fun-0-',0},
    {rabbit,start_it,1},
    {rpc,'-handle_call_call/6-fun-0-',5}]

Error: {error,{inconsistent_cluster,"Node rabbit@h101 thinks it's clustered with node rabbit@h102, but rabbit@h102 disagrees"}}
[root@h101 ~]#

解决办法是一旦有机会连上h101 ,就对它进行重置

代码语言:javascript复制
[root@h101 ~]# rabbitmqctl reset
Resetting node rabbit@h101 ...
[root@h101 ~]# rabbitmqctl start_app 
Starting node rabbit@h101 ...
[root@h101 ~]# rabbitmqctl cluster_status  
Cluster status of node rabbit@h101 ...
[{nodes,[{disc,[rabbit@h101]}]},
 {running_nodes,[rabbit@h101]},
 {cluster_name,<<"rabbit@h101.temp">>},
 {partitions,[]}]
[root@h101 ~]# 

原文地址

0 人点赞