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

Jit picture Jit · Dec 19, 2017 · Viewed 23.2k times · Source

I installed erlang and rabbitmq in the way mentioned in the official documentation. But then, when I do this

C:\Program Files\RabbitMQ Server\rabbitmq_server-3.7.0\sbin>rabbitmqctl add_user XXXXXX YYYYYYY

it gives me the following error...


Error: unable to perform an operation on node 'rabbit@C001741998'. 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:

DIAGNOSTICS

attempted to contact: [rabbit@C001741998]

rabbit@C001741998:

  • connected to epmd (port 4369) on C001741998

  • 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: rabbitmqcli49@C001741998

  • effective user's home directory: C:\Users\XYZ

  • Erlang cookie hash: QJlwBuAgrn8gN00mjqQYOw==


I copied the erlang cookie from my user home folder to C:\Windows folder. So, they both have the same cookie. Still it keeps throwing me the error. Not sure how it should be fixed. Any help??

UPDATE

I figured out that the best way to run rabbitmq is from docker container. In that way, you do not need to bother about any cookie or dependencies, also you get rabbitmq up and running in few minutes. Hope it helps someone!

Answer

Daniel picture Daniel · Jan 25, 2018

The docs says you should copy the other way...

If the Windows service is used, the cookie should be copied from C:\Windows\system32\config\systemprofile\.erlang.cookie to the expected location for users running commands like rabbitmqctl.bat.

See http://www.rabbitmq.com/cli.html