RabbitMQ 集群脑裂

现象

巡检发现RabbitMQ集群有2个节点离线,RabbitMQ GUI 页面如下:

Alt text

参考如下命令,对宕机的2个节点重启了rabbitmq服务:

rabbitmqctl stop
rabbitmq-server -detached
sleep 5 && netstat -lnpt | egrep "(15672|55672|5672)"
rabbitmqctl cluster_status

重启之后看到3个节点都已经online,RabbitMQ GUI 页面如下:

Alt text

但是 RabbitMQ GUI 上 Overview 有如下提醒:

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.

Alt text

原因分析

这是由于网络问题,或者多数个节点离线,导致集群出现了脑裂。

解决办法

对3个节点依次重启rabbitmq服务,并确认端口已监听:

rabbitmqctl stop
rabbitmq-server -detached
sleep 5 && netstat -lnpt | egrep "(15672|55672|5672)"
rabbitmqctl cluster_status

再次刷新 RabbitMQ GUI 页面,Overview 已经没有 Network partition 提醒了。

Copyright © www.sqlfans.cn 2024 All Right Reserved更新时间: 2023-07-17 14:14:47

results matching ""

    No results matching ""