RabbitMQ, Erlang: How to "make sure the erlang cookies are the same"

77,358

Solution 1

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.

Solution 2

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.

Solution 3

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

Solution 4

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

Solution 5

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.

Share:
77,358

Related videos on Youtube

Mikey
Author by

Mikey

I am learning Grails. It is awesome.

Updated on July 09, 2022

Comments

  • Mikey
    Mikey almost 2 years

    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.

    • Muzaaya Joshua
      Muzaaya Joshua about 12 years
      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.
    • Mick
      Mick about 11 years
      If people are not running a cluster, they might be interested to read this very similar issue.
  • Mikey
    Mikey about 12 years
    ah so the service can be running without rabbit running?
  • Steve Martin
    Steve Martin about 12 years
    Indeed. The service is a host to the RabbitMQ server which can be started and stopped. Much like IIS and the hosted web sites within.
  • Michal
    Michal over 7 years
    This is the correct answer. Thank you very much, you saved me from pain.
  • Der_Meister
    Der_Meister almost 7 years
    The solution is described in official documentation: rabbitmq.com/install-windows-manual.html
  • Todd Vance
    Todd Vance almost 7 years
    I try that and still get auth failed...but only on my rackspace vms
  • robasaurus
    robasaurus about 6 years
    Yes this works on Windows 10 where I had the same issue.
  • camjocotem
    camjocotem about 6 years
    Is this definitely a Windows 10 issue and not a result of upgrading to Erlang 20.2? From rabbitmq.com/clustering.html : For the RabbitMQ Windows service - %USERPROFILE%\\.erlang.cookie (usually C:\\WINDOWS\\system32\\config\\systemprofile)
  • Albert
    Albert almost 6 years
    Also applies to 2008R2, where I installed both erlang (20.3) and rabbitmq (3.7.3) through chocolatey.
  • Daniel Orlan
    Daniel Orlan almost 6 years
    Can confirm that this is the proper location for the cookie in Windows Server 2016 aswell.
  • Daniel Orlan
    Daniel Orlan almost 6 years
    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.
  • DL Narasimhan
    DL Narasimhan almost 5 years
    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.