我尝试在Windows服务器上建立RabbitMQ集群,这需要使用共享Erlang cookie文件。根据文档,我所需要做的就是确保不同机器上的根目录包含相同的.erlang.cookie文件。所以我所做的就是在两台机器上找到这些文件,并用相同的共享版本覆盖它们。
之后所有rabbitmqctl命令在机器上失败与新的文件版本与“无法连接到节点...”错误信息.我试图重新启动rabbitMQ Windows服务,但rabbitmqctl仍然抱怨.我甚至重新安装了rabbitMQ在那台机器上,但随后.erlang.cookie被重置回旧版本.每当我试图使用新版本的cookie文件,rabbitmqctl失败.当我恢复一个旧版本,它工作得很好。
基本上我被卡住了,在我解决这个问题之前不能继续进行群集设置。任何帮助都将不胜感激。
更新:收到RabbitMQ的回复:rabbitmqctl将从用户主目录中获取cookie,而服务将从C:\windows中获取cookie。因此,您需要将它们彼此同步,以及与另一台机器同步。
这基本上意味着cookie文件需要在两个地方重新调整:C:\Windows和当前用户。
1条答案
按热度按时间fwzugrvs1#
You have the above correct. The service will use the cookie at
C:\Windows
and when you userabbitmqctl.bat
to query the status it is using the cookie in your user directory (%USERPROFILE%
).When the cookies don't match the error look like
There is one more gotcha for RabbitMQ cookies on Windows... If you have a
%HOMEDIR%
and%HOMEPATH%
environment variables (as we do in our current test environment, and sets homedir above toU:\
), then RabbitMQ will get the cookie there and if there isn't one it makes one up and writes it there. This left me banging my head on my desk for quite a while when trying to get this working. Once I found this gotcha it was obvious the cookie files were the problem (as documented) they were just at an odd location (not documented AFAIK).Hope this solves someones pain setting up RabbitMQ Clustering on Windows.