无法加入rabbitMQ群集:错误:nodedown

时间:2016-03-24 09:31:20

标签: rabbitmq cluster-computing

我是RabbitMQ和Linux的新手。 我正在关注聚类指南 https://www.rabbitmq.com/clustering.html

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

我已将erlang cookie复制到所有计算机上。

我已在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==

任何人都可以帮我弄清楚这有什么问题吗?

2 个答案:

答案 0 :(得分:4)

您的节点名为rabbit@localhost

Clustering node rabbit@localhost with rabbit@rabbit1

您需要验证hostname命令返回的内容。为了使聚类工作,它必须返回例如。 rabbit1。如果它返回localhost,请验证主机的配置。怎么做取决于分布。

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

echo rabbit1 > /etc/hostname

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

答案 1 :(得分:0)

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

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