rabbitmq无法重新加入集群,启动失败的问题

问题描述

原有的 rabbitmq 集群出现问题,无法启动,尝试删除 /var/lib/rabbitmq/.erlang.cookie 重新组集群,依旧无法启动

复制

# systemctl start rabbitmq-server.service
Job for rabbitmq-server.service failed because the control process exited with error code. See "systemctl status rabbitmq-server.service" and "journalctl -xe" for details.

解决分析

查看错误日志

复制

# journalctl -xe
-- Subject: Unit rabbitmq-server.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit rabbitmq-server.service has begun starting up.
Nov 24 14:26:20 controller03 rabbitmq-server[13522]: BOOT FAILED
Nov 24 14:26:20 controller03 rabbitmq-server[13522]: ===========
Nov 24 14:26:20 controller03 rabbitmq-server[13522]: Error description:
Nov 24 14:26:20 controller03 rabbitmq-server[13522]: {error,{inconsistent_cluster,"Node rabbit@controller03 thinks it's clustered with node rabbit@controller02, but rabbit@controller02 disagrees"}}
Nov 24 14:26:20 controller03 rabbitmq-server[13522]: Log files (may contain more information):
Nov 24 14:26:20 controller03 rabbitmq-server[13522]: /var/log/rabbitmq/rabbit@controller03.log
Nov 24 14:26:20 controller03 rabbitmq-server[13522]: /var/log/rabbitmq/rabbit@controller03-sasl.log
Nov 24 14:26:20 controller03 rabbitmq-server[13522]: Stack trace:
Nov 24 14:26:20 controller03 rabbitmq-server[13522]: [{rabbit_mnesia,check_cluster_consistency,0,
Nov 24 14:26:20 controller03 rabbitmq-server[13522]: [{file,"src/rabbit_mnesia.erl"},{line,598}]},
Nov 24 14:26:20 controller03 rabbitmq-server[13522]: {rabbit,'-boot/0-fun-0-',0,[{file,"src/rabbit.erl"},{line,275}]},
Nov 24 14:26:20 controller03 rabbitmq-server[13522]: {rabbit,start_it,1,[{file,"src/rabbit.erl"},{line,296}]},
Nov 24 14:26:20 controller03 rabbitmq-server[13522]: {init,start_it,1,[]},
Nov 24 14:26:20 controller03 rabbitmq-server[13522]: {init,start_em,1,[]}]
Nov 24 14:26:21 controller03 rabbitmq-server[13522]: {"init terminating in do_boot",{error,{inconsistent_cluster,"Node rabbit@controller03 thinks it's clustered with node rabbit@controller02, but rabbit@controller02 disagrees"}}}
Nov 24 14:26:21 controller03 rabbitmq-server[13522]: init terminating in do_boot ()
Nov 24 14:26:22 controller03 rabbitmq-server[13522]: Crash dump is being written to: erl_crash.dump...done
Nov 24 14:26:22 controller03 systemd[1]: rabbitmq-server.service: main process exited, code=exited, status=1/FAILURE

可以看到错误描述

复制

{error,{inconsistent_cluster,"Node rabbit@controller03 thinks it's clustered with node rabbit@controller02, but rabbit@controller02 disagrees"}}

controller03 认为 controller02 是其 cluster node,但是controller02并不是

推测是之前集群残留的cluster信息,导致认证失败。官网查询到因为mnesia的信息残留,故会认证失败。

解决办法

1. 删除已有 mnesia 信息

复制

# rm /var/lib/rabbitmq/mnesia

2. 重启服务,状态恢复正常

复制

# systemctl restart rabbitmq-server.service

rabbitmqctl cluster_status
Cluster status of node rabbit@controller03 ...
[{nodes,[{disc,[rabbit@controller03]}]},
 {running_nodes,[rabbit@controller03]},
 {cluster_name,<<"rabbit@controller03">>},
 {partitions,[]},
 {alarms,[{rabbit@controller03,[]}]}]

3. 加入集群查看状态

复制

# rabbitmqctl stop_app
Stopping node rabbit@controller03 ...
[root@controller03 ~]# rabbitmqctl join_cluster --ram rabbit@controller01
Clustering node rabbit@controller03 with rabbit@controller01 ...


# rabbitmqctl start_app
Starting node rabbit@controller03 ...

# rabbitmqctl cluster_status
Cluster status of node rabbit@controller03 ...
[{nodes,[{disc,[rabbit@controller01]},
         {ram,[rabbit@controller03,rabbit@controller02]}]},
 {running_nodes,[rabbit@controller01,rabbit@controller03]},
 {cluster_name,<<"rabbit@controller01">>},
 {partitions,[]},
 {alarms,[{rabbit@controller01,[]},{rabbit@controller03,[]}]}]

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏全栈架构

Spring Boot与Kotlin使用Spring Data Rest创建HAL风格Restful接口

REST web服务已成为在web上应用程序集成的首选方式。在其核心中,REST定义了系统由客户端交互的资源组成。这些资源以超媒体驱动的方式实现。Spring ...

942
来自专栏耕耘实录

当SSH免密登录的私钥被移动之后... ...

版权声明:本文为耕耘实录原创文章,各大自媒体平台同步更新。欢迎转载,转载请注明出处,谢谢。

1203
来自专栏技术墨客

Spring核心——注解自动装载 原

之前的文章介绍了Spring的IoC容器配置管理方面的详细内容,需要了解的可以从IoC容器的设计模式开始阅读。在介绍基于注解配置的配置之前我们再重复一下在之前提...

2506
来自专栏颇忒脱的技术博客

Spring、Spring Boot和TestNG测试指南 - @OverrideAutoConfiguration

在Chapter 1: 基本用法 - 使用Spring Boot Testing工具里提到:

1632
来自专栏用户画像

gitlab配置ssh key

712
来自专栏Ken的杂谈

Spring Cloud 入门教程8、服务网关Zuul+Hystrix:断路处理与监控

参考上一篇:https://ken.io/note/spring-cloud-zuul-quickstart 基于源码:https://github.com/k...

2.5K2
来自专栏Web项目聚集地

从零学习Spring Boot-入门起步

Spring Boot是Spring社区较新的一个项目。该项目的目的是帮助开发者更容易的创建基于Spring的应用程序和服务,让更多人的人更快的对Spring进...

1093
来自专栏大数据学习笔记

Hadoop基础教程-第13章 源码编译(13.1 Zookeeper源码编译)

第13章 源码编译 13.1 Zookeeper源码编译 13.1.1 安装Ant 注意,不要下载最新版,下载指定版本 http://archive.apa...

2405
来自专栏WindCoder

springBoot初探-创建项目

一边学习公司用到的技术,一边重构小程序后端,从而更好的理解公司搭建的框架。此处记录一个用idea+gradle+springboot的基础实现。

671
来自专栏清晨我上码

第十节 spring could security实现OAuth2

2942

扫码关注云+社区

领取腾讯云代金券