RabbitMQ failed to start, TCP connection succeeded but Erlang distribution failed

无人久伴 提交于 2020-02-02 02:14:27

问题


I'm a new one just start to learn and install RabbitMQ on Windows System.

I install Erlang VM and RabbitMQ in custom folder, not default folder (Both of them).

Then I have restarted my computer.

By the way,My Computer name is "NULL"


I cd to the RabbitMQ/sbin folder and use command:

rabbitmqctl status

But the return message is:

Status of node rabbit@NULL ...

Error: unable to perform an operation on node 'rabbit@NULL'. 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 http://rabbitmq.com/documentation.html to learn more
  • Consult server logs on node rabbit@NULL

DIAGNOSTICS

attempted to contact: [rabbit@NULL]

rabbit@NULL:

  • connected to epmd (port 4369) on NULL
  • epmd reports node 'rabbit' uses port 25672 for inter-node and CLI tool traffic
  • TCP connection succeeded but Erlang distribution failed

  • Authentication failed (rejected by the remote node), please check the Erlang cookie

Current node details:

  • node name: rabbitmqcli70@NULL
  • effective user's home directory: C:\Users\Jerry Song
  • Erlang cookie hash: 51gvGHZpn0gIK86cfiS7vp==

I have try to RESTART RabbitMQ, What I get is:

ERROR: node with name "rabbit" already running on "NULL"


By the way,My Computer name is "NULL" And I have enable all ports in firewall.


回答1:


https://groups.google.com/forum/#!topic/rabbitmq-users/a6sqrAUX_Fg describes the problem where there is a cookie mismatch on a fresh installation of Rabbit MQ. The easy solution on windows is to synchronize the cookies

Also described here: http://www.rabbitmq.com/clustering.html#erlang-cookie

Ensure cookies are synchronized across 1, 2 and Optionally 3 below

  1. %HOMEDRIVE%%HOMEPATH%\.erlang.cookie (usually C:\Users\%USERNAME%\.erlang.cookie for user %USERNAME%) if both the HOMEDRIVE and HOMEPATH environment variables are set

  2. %USERPROFILE%\.erlang.cookie (usually C:\Users\%USERNAME%\.erlang.cookie) if HOMEDRIVE and HOMEPATH are not both set

  3. For the RabbitMQ Windows service - %USERPROFILE%\.erlang.cookie (usually C:\WINDOWS\system32\config\systemprofile)

The cookie file used by the Windows service account and the user running CLI tools must be synchronized by copying the one from C:\WINDOWS\system32\config\systemprofile folder.




回答2:


If you are using dedicated drive folder locations for your development tools/software in Windows10(Not the windows default location), one way you can synchronize the erlang cookie as described by https://www.rabbitmq.com/cli.html is by copying the cookie as explained below.

Please note in my case HOMEDRIVE and HOMEPATH environment variables both are not set.


After copying the "C:\Windows\system32\config\systemprofile\.erlang.cookie" to "C:\Users\%USERNAME%\.erlang.cookie" ,

the error "tcp connection succeeded but Erlang distribution failed" is resolved.


Now I am able to use "rabbitmqctl.bat status" command successfully. Hence there is no mandatory need to install in default location to resolve this error as synchronizing cookie will resolve that error.




回答3:


I have reinstall the RabbitMQ in my computer by using default setup foler

Then check with the command :

rabbitmqctl status

It work now, not the problem of Erlang VM .(Means Er can install at other foler)

It will cause some problem (like this one) that I couldn't find out now if we don't use the RabbitMQ default setup require foler (C:\Program Files\RabbitMQ Server)

If anyone find it out, I hope you can tell me why and how to fix.




回答4:


In Centos.

  1. add ip nodename pair to /etc/hosts on each node.

  2. restart rabbitmq-server service on each slave node.

works for me.




回答5:


Just adding my experience if it helps others down the line.

I wrote a Powershell .ps1 script to install and configure RabbitMQ which would be used as one of the stept to provision a server with Packer.

I wrote the code on a fresh AWS W2016 Server build. It worked fine when run on the box (as administrator, from an admin PS console) but when the same code was moved over to the Packer build server, it would fall over when doing the rabbitmqctl.bat configuration steps via packer, despite both using (as far as I can tell) Administrator to run the scripts.

So this worked on the coding box:

$pathvargs = {cmd.exe /c "rabbitmqctl.bat" add_user Username Password}
Invoke-Command -ScriptBlock $pathvargs
$pathvargs = {cmd.exe /c "rabbitmqctl.bat" set_user_tags User administrator}
Invoke-Command -ScriptBlock $pathvargs
$pathvargs = {cmd.exe /c "rabbitmqctl.bat" set_permissions -p "/" User "^User-.*" ".*" ".*"}
Invoke-Command -ScriptBlock $pathvargs
Write-Host "Did RabbitMQ"

But I had to prelude this with...

copy "C:\Windows\system32\config\systemprofile\.erlang.cookie" "C:\Program Files\RabbitMQ Server\rabbitmq_server-3.7.17\sbin\.erlang.cookie"
copy "C:\Windows\system32\config\systemprofile\.erlang.cookie" $env:userprofile\.erlang.cookie -force

... On the Packer box.

I am guessing there is some context issue going on but I'm using

"winrm_username":       "Administrator",

in the Packer builders block, so I thought this would suffice.

TL;DR - Use the Cookie even though it works without it in some instances.



来源:https://stackoverflow.com/questions/47874958/rabbitmq-failed-to-start-tcp-connection-succeeded-but-erlang-distribution-faile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!