I am using RabbitMQ with Grails, and a problem cropped up this morning. When I run rabbitmqctl
status it tells me:
C:\\Users\\BuildnTest2>rab
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
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.
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.
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
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.