简体   繁体   中英

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM