【问题标题】:Can't establish TCP connection, RabbitMQ无法建立 TCP 连接,RabbitMQ
【发布时间】: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


【解决方案1】:

客户端机器无法解析指向rabbitmq服务器的主机名。

如果 IP 地址未公开传播,则必须将 IP/主机组合放入 /etc/hosts 文件中。

您也可以尝试连接到 IP 地址而不是主机名,以清除任何其他与网络相关的问题。

【讨论】:

    猜你喜欢
    • 2015-10-02
    • 1970-01-01
    • 2016-11-30
    • 2012-11-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-30
    • 2013-04-07
    相关资源
    最近更新 更多