在 Windows 服务器上设置 RabbitMQ 集群 [英] Setting up RabbitMQ cluster on Windows servers

查看:28
本文介绍了在 Windows 服务器上设置 RabbitMQ 集群的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Windows 服务器上设置 RabbitMQ 集群,这需要使用共享的 Erlang cookie 文件.根据文档,我需要做的就是确保不同机器上的根目录包含相同的 .erlang.cookie 文件.所以我所做的是在两台机器上找到这些文件并用相同的共享版本覆盖它们.

I am trying to set up a RabbitMQ cluster on Windows servers, and this requires using shared Erlang cookie file. According to the documentation, all I need to do is to ensure that the root directories on different machines contain the same .erlang.cookie file. So what I did is found these files on both machines and overwrote them with the same shared version.

在那之后,所有rabbitmqctl命令在新文件版本的机器上都失败了,并显示无法连接到节点..."错误消息.我试图重新启动 RabbitMQ Windows 服务,但还是 rabbitmqctl 抱怨.我什至在那台机器上重新安装了 RabbitMQ,但随后 .erlang.cookie 被重置回旧版本.每当我尝试使用新版本的 cookie 文件时,rabbitmqctl 都会失败.当我恢复旧版本时,它运行良好.

After that all rabbitmqctl commands failed on the machine with new file version with "unable to connect to node..." error message. I tried to restart RabbitMQ Windows service, but still rabbitmqctl complained. I even reinstalled RabbitMQ on that machine, but then .erlang.cookie was reset back to the old version. Whenever I tried to use new version of cookie file, rabbitmqctl failed. When I restored an old version, it worked fine.

基本上我被卡住了,无法继续进行集群设置,直到我解决了这个问题.任何帮助表示赞赏.

Basically I am stuck and can not proceed with cluster setup until I resolve this issue. Any help is appreciated.

更新:收到来自 RabbitMQ 的答复:rabbitmqctl 将从用户主目录获取 cookie,而服务将从 C:windows 获取它.因此您需要将它们彼此同步,以及与另一台机器同步."

UPDATE: Received an answer from RabbitMQ: "rabbitmqctl will pick up the cookie from the user home directory while the service will pick it up from C:windows. So you will need to synchronise those with each other, as well as with the other machine."

这基本上意味着 cookie 文件需要在两个位置进行替换:C:Windows 和 current_user.

This basically means that cookie file needs to be repaced in two places: C:Windows and current_user.

推荐答案

你说的对.该服务将使用 C:Windows 中的 cookie,当您使用 rabbitmqctl.bat 查询它使用用户目录中的 cookie 的状态时 (%USERPROFILE%).

You have the above correct. The service will use the cookie at C:Windows and when you use rabbitmqctl.bat to query the status it is using the cookie in your user directory (%USERPROFILE%).

当cookies不匹配时的错误样子

When the cookies don't match the error look like

C:Program Files (x86)RabbitMQ Server
abbitmq_server-2.8.2sbin>rabbitmqctl.bat status
Status of node 'rabbit@PC-FOOBAR' ...
Error: unable to connect to node 'rabbit@PC-FOOBAR': nodedown

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

nodes in question: ['rabbit@PC-FOOBAR']

hosts, their running nodes and ports:
- PC-FOOBAR: [{rabbit,49186},{rabbitmqctl30566,63150}]

current node details:
- node name: 'rabbitmqctl30566@pc-foobar'
- home dir: U:
- cookie hash: Vp52cEvPP1PukagWi5S/fQ==

Windows 上的 RabbitMQ cookie 还有一个问题...如果您有 %HOMEDIR%%HOMEPATH% 环境变量(就像我们在当前测试环境,并将上面的 homedir 设置为 U:),然后 RabbitMQ 将在那里获取 cookie,如果没有,它会创建一个并将其写入那里.这让我在试图让它工作时把头撞在桌子上很长一段时间.一旦我发现了这个问题,很明显 cookie 文件就是问题所在(如文档所述),它们只是在一个奇怪的位置(未记录在 AFAIK).

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 to U:), 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).

希望这能解决一些人在 Windows 上设置 RabbitMQ 集群的痛苦.

Hope this solves someones pain setting up RabbitMQ Clustering on Windows.

这篇关于在 Windows 服务器上设置 RabbitMQ 集群的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆