Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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:

  • See the CLI, clustering and networking guides on http://rabbitmq.com/documentation.html to learn more
  • Consult server logs on node rabbit@C001741998

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!

like image 587
Jit Avatar asked Dec 19 '17 19:12

Jit


People also ask

What is Erlang cookie in RabbitMQ?

The Erlang cookie is a shared secret used for authentication between RabbitMQ nodes and CLI tools. The value is stored in a file commonly referred to as the Erlang cookie file. The cookie file used by the service account and the user running rabbitmqctl. bat must be synchronised for CLI tools such as rabbitmqctl.

How do you make RabbitMQ Erlang cookies?

The erlang cookie can be defined using the RABBITMQ_ERLANG_COOKIE variable. For example, if RabbitMQ is running on a Linux system, the export command can be used to define the erlang cookie. Or if running RabbitMQ on Docker, the -e or --env option can be used to define the Erlang cookie.

What is a RabbitMQ node?

A RabbitMQ node is the basic "message broker" service (process running on a server) which provides core RabbitMQ features such as exchanges, virtual hosts, queues, etc. You need at least one RabbitMQ node to be up-and-running, to use RabbitMQ.


2 Answers

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

like image 132
Daniel Avatar answered Sep 19 '22 14:09

Daniel


In case, like me, you need this stuff really spelling out:

  1. In FileExplorer navigate to your user directory. (Paste %userprofile% in the address bar.)
  2. If you already have the file .erlang.cookie in there, delete it. If not, just go to next step.
  3. In a second FileExplorer, navigate to C:\Windows\System32\config\systemprofile.
  4. Find the file .erlang.cookie and copy it to your user directory.

Now your rabbitmqctl should be able to authenticate.

like image 38
Robino Avatar answered Sep 18 '22 14:09

Robino