RabbitMQ: rabbitmqctl is unable to connect to node rabbit@localhost: nodedown

I just installed RabbitMQ in Arch Linux from the AUR and can start it without problems using systemctl.

sudo systemctl start rabbitmq

(BTW: I don’t have strong feelings against systemd, to the contrary, it feels very right and sysv/initscripts had to go away at some point. A more verbose output from starting the services would be nice however. I kinda miss the colorful output from Arch Linux’ /etc/rc.d/ scripts)

I can interact with the message queue in Java. When I run the rabbitmqctl command line utility, RabbitMQ mysteriously states to be down:

$ sudo /usr/sbin/rabbitmqctl status
Listing queues ...
Error: unable to connect to node rabbit@localhost: nodedown


nodes in question: [rabbit@localhost]

hosts, their running nodes and ports:
- localhost: [{rabbit,53465},{rabbitmqctl30769,35477}]

current node details:
- node name: rabbitmqctl30769@localhost
- home dir: /home/username
- cookie hash: *********************

See that line about home dir? That shouldn’t be there because RabbitMQ is running as the rabbitmq user. But since I have my /etc/sudoers set up so as to keep the HOME environment variable, the script is run in the wrong context. This can be fixed by setting HOME to rabbitmq’s home dir:

$ HOME=/var/lib/rabbitmq sudo /usr/sbin/rabbitmqctl status
 Status of node rabbit@localhost ...
                        {os_mon,"CPO  CXC 138 46","2.2.10"},
                        {mnesia,"MNESIA  CXC 138 12","4.7.1"},
                        {sasl,"SASL  CXC 138 11","2.2.1"},
                        {stdlib,"ERTS  CXC 138 10","1.18.3"},
                        {kernel,"ERTS  CXC 138 10","2.15.3"}]},
 {erlang_version,"Erlang R15B03 (erts-  [64-bit] [smp:4:4] [async-threads:30] [hipe] [kernel-poll:true]\n"},

Huzzah! It works🙂 Because I am lazy, I hard-coded the HOME=/var/lib/rabbitmq line into /usr/sbin/rabbitmq-env which is prob ably a very bad idea but it works.(TM)

Tagged with: , , , ,
Posted in Code, Linux
One comment on “RabbitMQ: rabbitmqctl is unable to connect to node rabbit@localhost: nodedown
  1. Nobody says:

    Nicer way:

    $ sudo -u rabbitmq rabbitmqctl status


    $ sudo -i -u rabbitmq
    rabbitmq$ rabbitmqctl status

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: