作者:叶斯琪147- | 来源:互联网 | 2023-08-13 14:46
现象:RabbitMQGUI上显示NetworkpartitiondetectedMnesiareportsthatthisRabbitMQclusterhasexperience
现象:
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 [email protected] ...
[{nodes,[{disc,[[email protected],[email protected]]}]},
{running_nodes,[[email protected],[email protected]]},
{partitions,[]}]
...done.
然而当网络分区发生时,会变成这样:
# rabbitmqctl cluster_status
Cluster status of node [email protected] ...
[{nodes,[{disc,[[email protected],[email protected]]}]},
{running_nodes,[[email protected],[email protected]]},
{partitions,[{[email protected],[[email protected]]},
{[email protected],[[email protected]]}]}]
...done.
解决办法:
在出现问题的节点上执行: sbin/rabbitmqctl stop_app
在出现问题的节点上执行: sbin/rabbitmqctl start_app
注意:mq集群不能采用kill -9 杀死进程,否则生产者和消费者不能及时识别mq的断连,会影响生产者和消费者正常的业务处理。
--本篇文章转自:https://www.cnblogs.com/liyongsan/p/9640361.html