【发布时间】:2021-10-20 21:43:42
【问题描述】:
我是 RabbitMQ 的新手,我想使用以下命令在 centOS7 上运行 RabbitMQ 服务器实例:
sudo systemctl start rabbitmq-server
该命令似乎需要很长时间,当我停止该进程并检查日志文件时,一切正常,它表示 rabbit 已启动并正在运行。但是当我尝试使用 rabbitmqctl 执行任何命令时,我收到以下错误:
Error: unable to perform an operation on node 'rabbit@hostname'. 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@hostname
* If target node is configured to use long node names, don't forget to use --longnames with CLI tools
**DIAGNOSTICS**
attempted to contact: [rabbit@hostname]
rabbit@hostname:
* connected to epmd (port 4369) on hostname
* 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 'hostname' resolves, is reachable and ports 25672, 4369 are not blocked by firewall
Current node details:
* node name: 'rabbitmqcli-806330-rabbit@hostname'
* effective user's home directory: /var/lib/rabbitmq
* Erlang cookie hash: KgAE7WR3dl5/FGAyWKE5LA==
我尝试手动终止进程,但没有成功。 每个需要的端口都在监听,我可以远程登录它们。你能帮我看看问题出在哪里吗?
【问题讨论】:
-
您在
netstat -a | grep tcp中找到LISTEN的rabbitmq 端口吗?你有防火墙吗?问题很明显,一台服务器无法访问其他服务器端口。 -
你能在客户端服务器上使用
host <hostname>解析主机名吗? -
不,我得到的是连接超时。我已经尝试将主机名更改为我通过“主机名”命令获得的名称,并将结果放入 rabbitmq 环境变量文件中,但仍然没有机会。而且这个错误中的主机名也没有改变。
-
如果 IP 地址没有公开传播,您必须将 IP/主机组合放在
/etc/hosts文件中。您也可以尝试连接到 IP 地址而不是主机名。 -
你拯救了我的一天!谢谢!
标签: rabbitmq