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

DIAGNOSTICS
===========

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 ...
[{pid,29492},
 {running_applications,[{rabbit,"RabbitMQ","3.0.2"},
                        {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"}]},
 {os,{unix,linux}},
 {erlang_version,"Erlang R15B03 (erts-5.9.3.1)  [64-bit] [smp:4:4] [async-threads:30] [hipe] [kernel-poll:true]\n"},
 {memory,[{total,26910536},
          {connection_procs,48240},
          {queue_procs,19712},
          {plugins,0},
          {other_proc,9242498},
          {mnesia,60592},
          {mgmt_db,0},
          {msg_index,19800},
          {other_ets,675104},
          {binary,694688},
          {code,12272693},
          {atom,512601},
          {other_system,3364608}]},
 {vm_memory_high_watermark,0.4},
 {vm_memory_limit,1612960563},
 {disk_free_limit,1000000000},
 {disk_free,461266944},
 {file_descriptors,[{total_limit,924},
                    {total_used,4},
                    {sockets_limit,829},
                    {sockets_used,2}]},
 {processes,[{limit,1048576},{used,136}]},
 {run_queue,0},
 {uptime,912}]
...done.

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)

About these ads
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

    or

    $ 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

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: