问题描述
版本:3.9.7
节点数目:3
集群模式:pause_monority
现象:
- 一节点无响应,web页面显示节点异常
- rabbitmqctl status无法连接到node,提示需start app
- start app 无效,stop app卡住
日志特征:
Global hang workaround: global state on business@fa654b04-89f4-11ee-b62f-001410367720 seems broken
Faking nodedown/nodeup between business@51796596-89f6-11ee-b62f-001410367720 and business@de84eb2a-89f3-11ee-b927-001410367720
复现方法:
模拟断网三节点中一台,网络恢复后有极低概率出现
解决方法
在官方论坛询问后,有人建议先升级到3.13,使用Khepri代替Mnesia。
参考链接:https://github.com/rabbitmq/rabbitmq-server/commit/fba455c61c0b82f291b72bc05cc8199b8dbdae5c#diff-44f1009399fc89cb0d4bbd06f9d93f01af31fc5c4efd114e1220c2456eae22d1
从描述来看,即便引入新版本也没有令人满意的解决方案。他们的修复计划是:
- Get rid of Mnesia replacing it with Khepri.
- Once mirrored classic queues are removed, get rid of rabbit_node_monitor.
- Have a clear and consistent view of the nodes comprising a RabbitMQ Cluster:
In other words, do not use different sources of truths like nodes(),
Mnesia, Ra clusters, global monitor at different places in the code.
这样看来即使是升级到最新版本也不一定彻底解决,这里我建议检测特征日志来自动修复。
题外话
rabbitmq从3.13版本开始实验性地引入了Khepri,抛弃Mnesia,他们认为这能显著提高分区容错性,后续也将移除pause_monority/autoheal这些自动分区处理策略。具体效果如何有待观察,生产环境不建议立马使用。