Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run rabbitmqctl commands on remote machine?

I have rabbitmq docker container, running on different machine. What I want to do is execute rabbitmqctl command using shell script from another machine. I am newbie to rabbitmq, need guidance of experts

I have used rabbitmqadmin with the option of -H to connect to remote server. I am able to connect and perform rabbitmqadmin commands. But there is no option for rabbitmqctl to connect to a remote server.

$ rabbitmqadmin -H 127.2.2.1 -u abc -p abc list vhosts

$ rabbitmqctl add_vhost xyz

I want to execute command rabbitmqctl on remote machine. rabbitmqadmin does work.

How can I make rabbitmqctl work in the same way. Please guide.

like image 215
Sachin Bankar Avatar asked Jan 23 '26 07:01

Sachin Bankar


1 Answers

rabbitmqadmin uses the HTTP API, so it is enough to reach the http endpoint.

rabbitmqctl uses the erlang distribution, and in order to work it needs the same .erlang.cookie installed on the remote machine.

you can use -n paramenter in this way:

rabbitmqctl -n rabbit@remotemachine 

Check the documentation for more details

like image 139
Gabriele Santomaggio Avatar answered Jan 27 '26 00:01

Gabriele Santomaggio



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!