大家好,我是早九晚十二,目前是做运维相关的工作。写博客是为了积累,希望大家一起进步!
问题描述
今天在搭建rabbitmq集群时使用rabbitmqctl status
碰到如下问题:
Status of node rabbit@iZwz9cxht3eh2v5xk5yqx4Z ...
Error: unable to perform an operation on node 'rabbit@iZwz9cxht3eh2v5xk5yqx4Z'. Please see diagnostics information and suggestions below.
Most common reasons for this are:
* Target node is unreachable (e.g. due to hostname resolution, TCP connection or firewall issues)
* CLI tool fails to authenticate with the server (e.g. due to CLI tool's Erlang cookie not matching that of the server)
* Target node is not running
In addition to the diagnostics info below:
* See the CLI, clustering and networking guides on http://rabbitmq.com/documentation.html to learn more
* Consult server logs on node rabbit@iZwz9cxht3eh2v5xk5yqx4Z
DIAGNOSTICS
===========
attempted to contact: [rabbit@iZwz9cxht3eh2v5xk5yqx4Z]
rabbit@iZwz9cxht3eh2v5xk5yqx4Z:
* unable to connect to epmd (port 4369) on iZwz9cxht3eh2v5xk5yqx4Z: nxdomain (non-existing domain)
Current node details:
* node name: 'rabbitmqcli-10319-rabbit@iZwz9cxht3eh2v5xk5yqx4Z'
* effective user's home directory: /var/lib/rabbitmq
* Erlang cookie hash: 48iUfALoSn26msGydd+V/g==
问题分析
主要看错误提示信息
- Target node is unreachable (e.g. due to hostname resolution, TCP connection or firewall issues)
- CLI tool fails to authenticate with the server (e.g. due to CLI
tool's Erlang cookie not matching that of the server)- Target node is not running
我们可以根据上面错误依次排查
提示一:*无法访问目标节点(例如,由于主机名解析、TCP连接或防火墙问题)
#查看firewall状态
firewall-cmd --state
#查看iptable策略
iptables -nL
提示二:*CLI工具无法与服务器进行身份验证(例如,由于CLI工具的Erlang cookie与服务器的Erlang cookie不匹配)
查看/var/lib/rabbitmq/.erlang.cookie文件md5是否与其他的cookie一致,一般windows会有多个.erlang.cookie文件,只需要将其中一个复制过去即可
提示三:*目标节点未运行
#查看rabbitmq是否为running状态
systemctl status rabbitmq-server
如果上述提示无法解决问题,那么再继续往下看
rabbit@iZwz9cxht3eh2v5xk5yqx4Z: * unable to connect to epmd (port
4369) on iZwz9cxht3eh2v5xk5yqx4Z: nxdomain (non-existing domain)
提示四:*无法连接到iZwz9cxht3eh2v5xk5yqx4Z上的epmd(端口4369)
该提示是表示无法解析到主机名(我本人的是这个问题),需要修改配置文件rabbitmq1为自己的主机名,然后重启。
[root@iZwz9cxht3eh2v5xk5yqx4Z rabbitmq-server-3.7.9]# cat /etc/rabbitmq/rabbitmq-env.conf
RABBITMQ_NODENAME=rabbit@rabbitmq1
码字不易,希望大家有用到的可以三连支持一波。哪里有问题的话可以指出,谢谢大家!