我正在尝试学习clustering Rabbitmq节点,并且正在关注this tutorial和the official documentation。
我有两个通过docker部署了Rabbitmq的物理机。机器1(192.168.1.2)将成为集群,而机器2(192.168.1.3)将成为集群。
当我尝试从machine2运行rabbitmqctl join_cluster rabbit@192.168.1.2
时,失败,并显示以下消息。
Clustering node rabbit@node2.rabbit with rabbit@192.168.1.2
Error: unable to perform an operation on node 'rabbit@192.168.1.2'. 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@192.168.1.2
* If target node is configured to use long node names, don't forget to use --longnames with CLI tools
DIAGNOSTICS
===========
attempted to contact: ['rabbit@192.168.1.2']
rabbit@192.168.1.3:
* connected to epmd (port 4369) on 192.168.1.2
* epmd reports node 'rabbit' uses port 25672 for inter-node and CLI tool traffic
* TCP connection succeeded but Erlang distribution failed
* suggestion: check if the Erlang cookie identical for all server nodes and CLI tools
* suggestion: check if all server nodes and CLI tools use consistent hostnames when addressing each other
* suggestion: check if inter-node connections may be configured to use TLS. If so, all nodes and CLI tools must do that
* suggestion: see the CLI, clustering and networking guides on https://rabbitmq.com/documentation.html to learn more
Current node details:
* node name: 'rabbitmqcli-1352-rabbit@node2.rabbit'
* effective user's home directory: /var/lib/rabbitmq
* Erlang cookie hash: XXXXXXXXXXXXX
machine1上的错误日志未显示任何与此类连接尝试有关的信息。我已经在两个docker容器上验证了cookie的md5sum,它们完全相同。权限也是如此。
我认为端口4369可能无法访问,但是可以访问。
我不确定我在做什么错。有人可以帮忙吗?
其他信息:
我正在使用rabbitmq:3.85管理图像。它使用Erlang / OTP 23 [erts-11.0.3]。
我一直在检查troubleshooting guide,,但不确定此处有什么问题。如果可以提供更多信息,请告诉我。
答案 0 :(得分:0)
因此,感谢@NeoAnderson和@JoséM,我能够理解发生了什么。
运行RMQ的容器需要通过Erlang在服务中通过网络使用的主机名进行访问。由于无法在另一台计算机上的容器中访问容器的主机名,因此该群集失败。
一个简单的解决方法是编辑容器上的/ etc / hosts文件,以便将IP指向“ leader”节点。
我这样做是为了避免安装RMQ,不是因为我认为这是最好的方法。或者,docker swarm或k8s会为我提供正确的网络。
但是根本原因肯定是节点名问题。