36

I am using RabbitMQ with Grails, and a problem cropped up this morning. When I run rabbitmqctl status it tells me:

C:\Users\BuildnTest2>rabbitmqctl status
Status of node 'rabbit@BUILDNTEST2-PC' ...
Error: unable to connect to node 'rabbit@BUILDNTEST2-PC': nodedown diagnostics:
- nodes and their ports on BUILDNTEST2-PC: [{rabbit,49164},
                                        {rabbitmqctl27693,49286}]
- current node: 'rabbitmqctl27693@BuildnTest2-PC'
- current node home dir: C:\Users\BuildnTest2
- current node cookie hash: cSYB8tsT4mGGZHSUGQi08w==

When I go to the Rabbit troubleshooting page they say:

then you should make sure the Erlang cookies are the same.

What does this mean and how is it accomplished?

Googling found this forum thread which claims to have instructions to solving this problem, but alas it just redirects back to the rabbit site where there is no answer.

2240
  • 1,547
  • 2
  • 12
  • 30
Mikey
  • 4,692
  • 10
  • 45
  • 73
  • check the node `home dir` and for each node, modify a file called `.erlang.cookie` and have the file contain the same value e.g. `echo mycookie > $NODE_HOME_DIR/.erlang.cookie` for each node. – Muzaaya Joshua Mar 13 '12 at 05:40
  • 1
    If people are not running a cluster, they might be interested to read [this very similar issue](http://stackoverflow.com/questions/10347751/rabbitmq-refusing-to-start). – Mick Feb 14 '13 at 14:21

14 Answers14

19

For what it's worth, in 2018, the docs are WRONG. In windows 10, the default location of the cookie file appears to be:

C:\Windows\System32\config\systemprofile

and NOT

C:\Windows

as the docs say.

The best thing to do is to look at the log file, which is typically located in your user %AppData%\Roaming\RabbitMQ\log directory.

The log file contains this entry, which helped me determine the cookie location:

node           : rabbit@computername
home dir       : C:\WINDOWS\system32\config\systemprofile
Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
neural
  • 400
  • 3
  • 5
  • Yes this works on Windows 10 where I had the same issue. – robasaurus Feb 23 '18 at 13:54
  • Is this definitely a Windows 10 issue and not a result of upgrading to Erlang 20.2? From [rabbitmq.com/clustering.html](https://www.rabbitmq.com/clustering.html) : For the RabbitMQ Windows service - %USERPROFILE%\\.erlang.cookie (usually C:\\WINDOWS\\system32\\config\\systemprofile) – camjocotem Mar 08 '18 at 13:44
  • Also applies to 2008R2, where I installed both erlang (20.3) and rabbitmq (3.7.3) through chocolatey. – Albert May 23 '18 at 14:42
  • Can confirm that this is the proper location for the cookie in Windows Server 2016 aswell. – Daniel Orlan Jun 28 '18 at 19:54
  • `rabbitmqctl status` was returning Authentication failed (rejected by the remote node) `effective user's home directory: C:\Users\Administrator` I copied over the .erlang to `C:\WINDOWS\system32\config\systemprofile` and it worked. – Daniel Orlan Jun 28 '18 at 20:00
  • Their docs are kinda ambiguous across versions! On Windows 10, I now no longer find .erlang.cookie. Looked up both `C:\WINDOWS\system32\config\systemprofile` and `c:\windows` with no luck. – DL Narasimhan Apr 26 '19 at 10:12
18

In my case, for some reason the cookie (.erlang.cookie) stored under C:\Windows\ was different from the one I had stored under my home (%HOMEDRIVE% %HOMEPATH%, which was C:\ for me).

Once I copied the cookie from C:\Windows into my my home folder everything started working.

Stefano Ricciardi
  • 2,923
  • 3
  • 33
  • 40
13

For those out there googling, this same erlang cookie error can happen when you are missing the HOME parameter from your environment configuration. For example, on the default ArchLinux installation of rabbitmq.

In this case, the service is started with systemctl start rabbitmq and it generates a cookie but the cli tools like rabbitmqctl status will not work out of the box because they do not know the home location.

default /etc/rabbitmq/rabbitmq-env.conf

NODENAME=rabbit
NODE_IP_ADDRESS=0.0.0.0
NODE_PORT=5672

LOG_BASE=/var/log/rabbitmq
MNESIA_BASE=/var/lib/rabbitmq/mnesia

modified /etc/rabbitmq/rabbitmq-env.conf

NODENAME=rabbit
NODE_IP_ADDRESS=127.0.0.1
NODE_PORT=5672

HOME=/var/lib/rabbitmq
LOG_BASE=/var/log/rabbitmq
MNESIA_BASE=/var/lib/rabbitmq/mnesia

ref https://bbs.archlinux.org/viewtopic.php?id=191587

slf
  • 22,595
  • 11
  • 77
  • 101
11

The definitive answer to your specific question, on the RabbitMQ site is at http://www.rabbitmq.com/clustering.html

However, from your status dump, it doesn't look as though this is your issue. It just looks as though your node is down. Am I correct in assuming that you aren't running a cluster? The fact that the node that you can't connect to is the same as the one you are running the commands from indicates this.

If the RabbitMQ service is running then run rabbitmqctl start If it isn't running then go to services and start it and then the above. The erlang cookie is irrelevant for non-clustered configurations.

Steve Martin
  • 1,632
  • 10
  • 19
8

In home directory of the user running erlang process, there is hidden file .erlang.cookie. It holds string which is responsible for the topology of erlang cluster. Make sure that the string (cookie) is the same across all nodes you want to connect. If there is no cookie, create one.

user425720
  • 3,578
  • 1
  • 21
  • 23
4

Synchronise Erlang Cookies (when running a manually installed Windows Service) Erlang Security Cookies used by the service account and the user running rabbitmqctl.bat must be synchronised for rabbitmqctl.bat to function. To ensure Erlang cookie files contain the same string, copy the .erlang.cookie file from the Windows directory (normally C:\WINDOWS.erlang.cookie) to replace the user .erlang.cookie. The user cookie will be in the user's home directory (%HOMEDRIVE%%HOMEPATH%), e.g. C:\Documents and Settings\%USERNAME%.erlang.cookie or C:\Users\%USERNAME%.erlang.cookie (Windows Vista and later).

https://www.rabbitmq.com/install-windows-manual.html

Aravind
  • 71
  • 2
4

I copied the cookie from C:\Windows into my home folder (C:\Users\Current User\.erlang.cookie) and everything started working fine.

Pang
  • 9,564
  • 146
  • 81
  • 122
onemanarmy
  • 93
  • 10
1

If you run the MacPorts version of rabbitmq-server on OSX, you need to check the ~rabbitmq/.erlang.cookie file. It must match the one in /opt/local/var/lib/rabbitmq/.erlang.cookie, otherwise "rabbitmqctl" is not able to connect.

Bertl
  • 605
  • 5
  • 10
1

I was trying to cluster and even when the cookies matched it wouldn't work for me... the only thing that finally worked was setting the ERLANG_HOME variable in my environment variables.

After I set this, I was able to copy the cookie from my master broker to the one I wanted to cluster with and the join worked fine.

"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. "

https://www.rabbitmq.com/install-windows-manual.html

Todd Vance
  • 4,627
  • 7
  • 46
  • 66
0

Make sure the rabbitmq erlang.cookie matches the erlang.cookie in your user directory:

The rabbitmq erlang cookie...

...will be typically located in /var/lib/rabbitmq/.erlang.cookie on Unix systems and C:\Users\Current User.erlang.cookie or C:\Documents and Settings\Current User.erlang.cookie on Windows systems. (http://www.rabbitmq.com/clustering.html#setup)

Make sure that matches with ~/.erlang.cookie.

kipple
  • 314
  • 2
  • 8
0

I observed this issue when clone server made alive with name change. Problem solved after clean rabbitmq and erlang installation.

ali kucuk
  • 31
  • 1
0

The proper way to change the original to custom erlang.cookie in LINUX, not sure about the other OS platforms.

pkill beam
pkill epmd
echo 'CUSTOMCOOKIE' > /var/lib/rabbitmq/.erlang.cookie
pkill beam
pkill epmd

wait for a few seconds like 30-60sec then start the app

rabbitmqctl start_app

Maybe the first attempt got failed then try a few more times it will work. If not then you messed up with something else.

0

Another location where the erlang cookie that RabbitMQ is using could be located at C:\Windows\SysWOW64\config\systemprofile on Windows.

julian zapata
  • 89
  • 1
  • 8
0

Clean install RabbitMQ

This might not be the ideal solution, but a clean install only worked after trying to fix the issue.

I have added all the errors, and fixes at each stage in this article.

Go to How to clean install rabbitmq if you need a quick fix.

Anjan Talatam
  • 2,212
  • 1
  • 12
  • 26