windows rabbitmqctl 错误:无法连接到节点 rabbit@myserver nodedown
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25409626/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
rabbitmqctl Error: unable to connect to node rabbit@myserver nodedown
提问by Alf47
I am running RabbitMQ v3.3.5 with Erlang OTP 17.1 on Windows 2008 R2. My Dev and QA environments are stand-alone. My staging and production environments are clustered.
我在 Windows 2008 R2 上运行带有 Erlang OTP 17.1 的 RabbitMQ v3.3.5。我的开发和 QA 环境是独立的。我的登台和生产环境是集群的。
I am finding this one problem happening often where the RabbitMQ service is running, the RabbitMQ management console is seeing everything, but when I try running rabbitmqctl from the command line it fails with an error saying that the node is down (tried locally and on a remote server).
我发现这个问题经常发生在 RabbitMQ 服务运行的地方,RabbitMQ 管理控制台可以看到所有内容,但是当我尝试从命令行运行 rabbitmqctl 时,它失败并显示节点已关闭的错误(在本地和在远程服务器)。
This problem is resolved if I restart the Windows service.
如果我重新启动 Windows 服务,这个问题就解决了。
I see no error message in the RabbitMQ error log. The last message indicated that the node was up.
我在 RabbitMQ 错误日志中没有看到错误消息。最后一条消息表明节点已启动。
Below is an example output of the issue that I recently experienced on node 2 of our staging windows cluster:
下面是我最近在暂存 Windows 集群的节点 2 上遇到的问题的示例输出:
PS C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.3.5\sbin> .\rabbitmqctl.bat status
Status of node rabbit@MYSERVER2 ...
Error: unable to connect to node rabbit@MYSERVER2: nodedown
DIAGNOSTICS
===========
attempted to contact: [rabbit@MYSERVER2]
rabbit@MYSERVER2:
* connected to epmd (port 4369) on MYSERVER2
* epmd reports: node 'rabbit' not running at all
no other nodes on MYSERVER2
* suggestion: start the node
current node details:
- node name: rabbitmqctl2199771@MYSERVER2
- home dir: C:\Users\RabbitMQ
- cookie hash: mn6OaTX9mS4DnZaiOzg8pA==
at this point I restart the RabbitMQ service and then try again
此时我重新启动RabbitMQ服务,然后再试一次
PS C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.3.5\sbin> .\rabbitmqctl.bat status
Status of node rabbit@MYSERVER2...
[{pid,3784},
{running_applications,
[{rabbitmq_management_agent,"RabbitMQ Management Agent","3.3.5"},
{rabbit,"RabbitMQ","3.3.5"},
{os_mon,"CPO CXC 138 46","2.2.15"},
{mnesia,"MNESIA CXC 138 12","4.12.1"},
{xmerl,"XML parser","1.3.7"},
{sasl,"SASL CXC 138 11","2.4"},
{stdlib,"ERTS CXC 138 10","2.1"},
{kernel,"ERTS CXC 138 10","3.0.1"}]},
{os,{win32,nt}},
{erlang_version,
"Erlang/OTP 17 [erts-6.1] [64-bit] [smp:4:4] [async-threads:30]\n"},
{memory,
[{total,35960208},
{connection_procs,2704},
{queue_procs,5408},
{plugins,111936},
{other_proc,13695792},
{mnesia,102296},
{mgmt_db,0},
{msg_index,21816},
{other_ets,884704},
{binary,25776},
{code,16672826},
{atom,602729},
{other_system,3834221}]},
{alarms,[]},
{listeners,[{clustering,25672,"::"},{amqp,5672,"::"},{amqp,5672,"0.0.0.0"}]},
{vm_memory_high_watermark,0.4},
{vm_memory_limit,3435787059},
{disk_free_limit,50000000},
{disk_free,74911649792},
{file_descriptors,
[{total_limit,8092},
{total_used,4},
{sockets_limit,7280},
{sockets_used,2}]},
{processes,[{limit,1048576},{used,139}]},
{run_queue,0},
{uptime,5}]
...done.
Any idea as to what causes this and how to automatically detect the situation?
关于导致这种情况的原因以及如何自动检测这种情况的任何想法?
Is this specifically a problem with running RabbitMQ on Windows?
这是在 Windows 上运行 RabbitMQ 的具体问题吗?
采纳答案by Jean-Sébastien Pédron
Hostnames are case-insensitives when you are trying to resolve them. For example, LOCALHOST
and localhost
are the same host.
当您尝试解析主机名时,主机名不区分大小写。例如,LOCALHOST
和localhost
是同一个主机。
However, when Erlang constructs the name of a node (eg. rabbit@<hostname>
in the case of RabbitMQ), this name is case-sensitive. So rabbit@LOCALHOST
and rabbit@localhost
are two different node names, even if they run on the same host.
但是,当 Erlang 构造节点的名称时(例如rabbit@<hostname>
,在 RabbitMQ 的情况下),该名称区分大小写。所以rabbit@LOCALHOST
和rabbit@localhost
是两个不同的节点名称,即使它们运行在同一台主机上。
Recently, we (the RabbitMQ team) found out that, on Windows, the node name constructed for RabbitMQ was inconsistent. Therefore, sometimes, RabbitMQ started as a Windows service could be named rabbit@MYHOST
but rabbitmqctl
would try to reach rabbit@myhost
and fail.
最近,我们(RabbitMQ 团队)发现,在 Windows 上,为 RabbitMQ 构造的节点名称不一致。因此,有时,RabbitMQ 启动为 Windows 服务可以命名rabbit@MYHOST
但rabbitmqctl
会尝试到达rabbit@myhost
并失败。
Since RabbitMQ 3.6.0, the node name should be consistent.
从RabbitMQ 3.6.0开始,节点名应该是一致的。
回答by NealWalters
To anyone else getting this error, this was my fix. I installed Erlang, but overlooked the instructions on setting up the Environmental Variable.
对于遇到此错误的其他人,这是我的解决方法。我安装了 Erlang,但忽略了设置环境变量的说明。
I was reading the manual install page: https://www.rabbitmq.com/install-windows-manual.htmland found the following:
我正在阅读手动安装页面:https: //www.rabbitmq.com/install-windows-manual.html并发现以下内容:
Set ERLANG_HOME to where you actually put your Erlang installation, e.g. C:\Program Files\erlx.x.x (full path). The RabbitMQ batch files expect to execute %ERLANG_HOME%\bin\erl.exe.
Go to Start > Settings > Control Panel > System > Advanced > Environment Variables. Create the system environment variable ERLANG_HOME and set it to the full path of the directory which contains bin\erl.exe.
将 ERLANG_HOME 设置为您实际放置 Erlang 安装的位置,例如 C:\Program Files\erlx.xx(完整路径)。RabbitMQ 批处理文件期望执行 %ERLANG_HOME%\bin\erl.exe。
转到开始 > 设置 > 控制面板 > 系统 > 高级 > 环境变量。创建系统环境变量 ERLANG_HOME 并将其设置为包含 bin\erl.exe 的目录的完整路径。
For some reason, the auto install assigned the wrong path name to the ERLANG_HOME variable - see image below. I simply added \bin on the end.
出于某种原因,自动安装为 ERLANG_HOME 变量分配了错误的路径名 - 请参见下图。我只是在最后添加了 \bin。
回答by James Oravec
I had a similar problem on my linux box and am posting the answer here, because rabbitmq on windows may handle things similarly.
我在我的 linux 机器上遇到了类似的问题,我在这里发布了答案,因为 windows 上的 rabbitmq 可能会处理类似的事情。
My post and solution: rabbtimqadmin - Could not connect: [Errno -2] Name or service not known
我的帖子和解决方案:rabbtimqadmin - 无法连接:[Errno -2] 名称或服务未知
The core issue was changing the servername after rabbitmq was configured. When installed, rabbitmq references the servers name, making it part of its configuration. I can see this being a similar issue on windows.
核心问题是在配置 rabbitmq 后更改服务器名称。安装后,rabbitmq 引用服务器名称,使其成为其配置的一部分。我可以看到这是 Windows 上的类似问题。
In short, you can change server's name back to the name it was when you first installed rabbitmq or you can add a rabbitmq-env.conf
file, I'm not sure where it would go in windows, but the following gives details for linux: https://www.rabbitmq.com/man/rabbitmq-env.conf.5.man.html
简而言之,您可以将服务器的名称更改回您第一次安装rabbitmq 时的名称,或者您可以添加一个rabbitmq-env.conf
文件,我不确定它在Windows 中的位置,但以下提供了Linux 的详细信息:https:// www.rabbitmq.com/man/rabbitmq-env.conf.5.man.html
Note that on linux the name of the server was CaSe SENiTivE! So you may or may not have a similar issue with windows.
请注意,在 linux 上,服务器的名称是 CaSe SENiTivE!因此,您可能会或可能不会遇到与 Windows 类似的问题。
Hope this helps and good luck!
希望这会有所帮助,祝你好运!
回答by Tushar Saxena
If you are using linux try to change permission of /var/lib/rabbitmq/mnesia folder.
如果您使用的是 linux,请尝试更改 /var/lib/rabbitmq/mnesia 文件夹的权限。