【问题标题】:Can't join rabbitMQ cluster: Error: nodedown无法加入rabbitMQ集群:错误:nodedown
【发布时间】:2016-03-24 18:33:33
【问题描述】:

我是 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

但是 hen 试图将 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==

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

【问题讨论】:

  • 你能从rabbit2 ping rabbit1 吗?
  • @DavinTryon:是的,我可以。

标签: rabbitmq cluster-computing


【解决方案1】:

你的节点被命名为rabbit@localhost:

Clustering node rabbit@localhost with rabbit@rabbit1

您需要验证hostname 命令返回的内容。为了使集群工作,它必须返回例如。 rabbit1。如果它返回localhost,请验证您的主机配置。如何做到这一点取决于分布。

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

echo rabbit1 > /etc/hostname

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

【讨论】:

  • 谢谢。在每台机器上将主机名(localhost)更改为rabbitX解决了这个问题。
  • 但是你能解释一下什么是 cluster_name 我看到它在所有节点上都设置为 rabbit@rabbit2。为什么?
  • RabbitMQ 任意选择集群的第一个成员作为集群名称。您可以使用 rabbitmqctl set_cluster_name $new_cluster_name 将其更改为您喜欢的任何内容
【解决方案2】:

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

还有一个提示,尝试使用 docker 代替 VM,它更快更轻。

【讨论】:

    猜你喜欢
    • 2019-07-05
    • 1970-01-01
    • 1970-01-01
    • 2015-03-31
    • 2019-01-15
    • 1970-01-01
    • 2016-01-05
    • 2023-03-13
    • 1970-01-01
    相关资源
    最近更新 更多