当我在本地服务器(特别是 rhel8)上运行
sudo rabbitmqctl status
时,我收到此错误
Error: unable to perform an operation on node 'rabbit@xxxxx'. 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 https://rabbitmq.com/documentation.html to learn more
* Consult server logs on node rabbit@xxxxxx
* If target node is configured to use long node names, don't forget to use --longnames with CLI tools
DIAGNOSTICS
===========
attempted to contact: ['rabbit@xxxxx']
rabbit@xxxxx:
* connected to epmd (port 4369) on xxxxxxx
* epmd reports node 'rabbit' uses port 25672 for inter-node and CLI tool traffic
* can't establish TCP connection to the target node, reason: timeout (timed out)
* suggestion: check if host 'xxxxxxxx' resolves, is reachable and ports 25672, 4369 are not blocked by firewall
Current node details:
* node name: 'rabbitmqcli-401-rabbit@xxxxx'
* effective user's home directory: /var/lib/rabbitmq
* Erlang cookie hash: gvMlNMNDWrRk2xONh+tqWQ==
Documentation: Table of Contents
— RabbitMQ
Erlang 版本 =
Erlang/OTP 25
Rabbitmq 版本 = 3.12.12
最新
我该如何修复这个错误?
我尝试使用
25672, 4369, 5671, and 15672
命令与端口 nc
建立 TCP 连接,并且连接成功。
此外,我还对主机名/IP 地址进行了 ping 操作以验证是否可以访问。
检查 RabbitMQ 服务器上的 Erlang cookie Cookie 的默认位置是:
/var/lib/rabbitmq/.erlang.cookie
cat /var/lib/rabbitmq/.erlang.cookie
将cookie复制到用户的主目录 使用 sudo 将 cookie 复制到运行
rabbitmqctl
的用户的主目录,例如 dam01
用户:
sudo cp /var/lib/rabbitmq/.erlang.cookie /home/dam01/.erlang.cookie
为cookie设置适当的权限 通过将权限设置为
400
,确保只有所有者才能读取该文件
sudo chmod 400 /home/dam01/.erlang.cookie
更新
/etc/hosts
文件
编辑 /etc/hosts
文件以将 127.0.0.1
映射到您的主机名:
sudo vi /etc/hosts
添加或修改以下行:
127.0.0.1 hostnamexxxxxx
重新启动 RabbitMQ 服务器并检查状态 停止、启动和验证 RabbitMQ 服务器:
sudo rabbitmq-server stop
sudo rabbitmq-server start
sudo rabbitmqctl status