Can't join rabbitMQ cluster: Error: nodedown

Can't join rabbitMQ cluster: Error: nodedown

我是 rabbitMQ 和 Linux 的新手。 我正在关注集群指南 https://www.rabbitmq.com/clustering.html

我有三个节点都是 运行 CentOS 7(在具有静态 IP 的虚拟机上)。

我已经将 erlang cookie 复制到所有机器上。

我在hosts文件中设置hosts如下 这在机器 2

127.0.0.1   localhost localhost.localdomain localhost4   localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.198.100   rabbit1
127.0.0.1 rabbit2
192.168.198.102   rabbit3

但是她试图使用

将 rabbit2 连接到 rabbit1
rabbitmqctl join_cluster rabbit@rabbit1

我收到以下错误

Clustering node rabbit@localhost with rabbit@rabbit1 ...
Error: unable to connect to nodes [rabbit@rabbit1]: nodedown

DIAGNOSTICS
===========

attempted to contact: [rabbit@rabbit1]

rabbit@rabbit1:
  * connected to epmd (port 4369) on rabbit1
  * epmd reports node 'rabbit' running on port 25672
  * TCP connection succeeded but Erlang distribution failed
  * suggestion: hostname mismatch?
  * suggestion: is the cookie set correctly?
  * suggestion: is the Erlang distribution using TLS?

current node details:
- node name: 'rabbitmq-cli-72@localhost'
- home dir: /var/lib/rabbitmq
- cookie hash: YlXmRhqgpV9H7lgqXslI1g==

谁能帮我弄清楚这是怎么回事?

您的节点名为 rabbit@localhost:

Clustering node rabbit@localhost with rabbit@rabbit1

您需要验证 hostname 命令 return 的内容。为了使聚类起作用,它必须 return 例如。 rabbit1。如果它 returns localhost,请验证主机的配置。如何做到这一点取决于分布。

在我这里的 Debian 和 Fedora 虚拟机上,主机名配置在 /etc/hostname 中。所以你需要这样的东西:

echo rabbit1 > /etc/hostname

但请先参考您的分发文档和工具。

我假设您已将 192.168.198.102 设置为您的 rabbit2 VM,因此您可以尝试将 /etc/hosts 中的行从 127.0.0.1 rabbit2192.168.198.102 rabbit2.

另外一个提示,尝试使用 docker 而不是 VM,它更快更轻。