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

查看:175
本文介绍了在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服务,但仍然抱怨兔子mqctl。我甚至在该机器上重新安装了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%).

当Cookie不匹配错误看起来像

When the cookies don't match the error look like

C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-2.8.2\sbin>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天全站免登陆