rabbitmqadmin [Errno 111] Connection refused

11.9k views Asked by At

So I keep getting "connection refused" from rabbitmqadmin. I'm running debian 7 on a vm as root user. I installed rabbitmq-server with apt-get, started it up and did the following:

rabbitmqctl add_user test 1234
rabbitmqctl set_user_tags test administrator
rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
rabbitmq-plugins enable rabbitmq_management

cd /usr/local/bin/
wget https://raw.githubusercontent.com/rabbitmq/rabbitmq-management/rabbitmq_v3_5_6/bin/rabbitmqadmin
chmod +x rabbitmqadmin

rabbitmqadmin -H 127.0.0.1 -u test -p 1234 list vhosts

But the call to rabbitmqadmin always results in Could not connect: [Errno 111] Connection refused

I have tried the following:

  • restarting the service (/etc/init.d/rabbitmq-server restart/stop/start)
  • verified that rabbitmq-management is enabled via rabbitmq-plugins list and checking /etc/rabbitmq/enabled_plugins
  • verified that rabbitmq-management actually started by checking rabbitmqctl status and the rabbitmq logs
  • removing/reinstalling rabbitmq-server
  • removing/reinstalling rabbitmqadmin
  • i checked that 127.0.0.1 was in fact listed in /etc/hosts

I tried rabbitmqadmin list users and I get the same problem. I'm pretty stumped, any ideas?

note: i'm not sure if it's relevant, but i had some trouble getting rabbitmq-server installed, i kept getting "unmet dependencies" issues and running apt-get -f install would remove some other packages that i needed. i think the problem actually came from installing erlang, and eventually got it working by going through the tree of unmet dependencies and installing each of them one at a time until erlang and rabbitmq-server were both installed.

ALSO i added "deb http://http.debian.net/debian wheezy-backports main" to /etc/apt/sources.list so i also tried removing rabbitmq-server, removing the repo, apt-get update and reinstalling rabbitmq-server, still nothing.

3

There are 3 answers

1
alex On

on debian 10, rabbitmq-server installed a lot of plugins, but enabled none by default.

you may list them as root with:

rabbitmq-plugins list

then you may:

rabbitmq-plugins enable rabbitmq_management

now you may run, as non-root user:

rabbitmqadmin list queues

and even

rabbitmqadmin delete queue name=rpc_queue

i did no special configuration.

0
Chris On

I found this solution:

rabbitmqadmin needs to talk to the management-website of the server. The same which you use as an admin. The default seems to be TCP port 15672, but the config that I am using (also Debian, but 9) is port 8080.

I found which port the management-interface runs on by looking into /etc/rabbitmq/rabbitmq.config where I found this:

       {rabbitmq_management, [{listener, [{port, 8080},

You could probably also try to check which open ports belong to the rabbitmq-server and try them all.

Finally, to use this information, I have created a config-file for rabbitmqadmin under ~/.rabbitmqadmin.conf and filled it with the info found in the output of rabbitmqadmin help config. (It might be important to remove leading spaces.)

0
Anton Borisovich On

just remove: /etc/rabbitmq/rabbitmq.conf and restart the service