Mnesia reports that this RabbitMQ cluster has experienced a network partition.

现象:

RabbitMQ GUI上显示

Network partition detected
Mnesia reports that this RabbitMQ cluster has experienced a network partition. There is a risk of losing data. Please read RabbitMQ documentation about network partitions and the possible solutions.

两个RabbitMQ节点互相识别不到对方:

原因分析:

这是由于网络问题导致集群出现了脑裂。

正常情况下,通过rabbitmqctl cluster_status命令查看到的信息中partitions那一项是空的,就像这样:

# rabbitmqctl cluster_status
Cluster status of node rabbit@smacmullen ...
[{nodes,[{disc,[hare@smacmullen,rabbit@smacmullen]}]},
 {running_nodes,[rabbit@smacmullen,hare@smacmullen]},
 {partitions,[]}]
...done.

然而当网络分区发生时,会变成这样:

# rabbitmqctl cluster_status
Cluster status of node rabbit@smacmullen ...
[{nodes,[{disc,[hare@smacmullen,rabbit@smacmullen]}]},
 {running_nodes,[rabbit@smacmullen,hare@smacmullen]},
 {partitions,[{rabbit@smacmullen,[hare@smacmullen]},
              {hare@smacmullen,[rabbit@smacmullen]}]}]
...done.

解决办法:



   在出现问题的节点上执行:  sbin/rabbitmqctl stop_app 
   在出现问题的节点上执行:  sbin/rabbitmqctl start_app 

注意:mq集群不能采用kill -9 杀死进程,否则生产者和消费者不能及时识别mq的断连,会影响生产者和消费者正常的业务处理。

--本篇文章转自:https://www.cnblogs.com/liyongsan/p/9640361.html

猜你喜欢

转载自blog.csdn.net/yabignshi/article/details/114315216