Install rabbitmqadmin on linux

让人想犯罪 __ 提交于 2019-12-10 01:47:58

问题


I'm trying to install and be able to run rabbitmqadmin on a linux machine. Following the instructions described here do not help.

After downloading the file linked, it prompts to copy the file (which looks like a python script) into /usr/local/bin.

Trying to run it by simply invoking rabbitmqadmin results in rabbitmqadmin: command not found. There seems to be no information anywhere about how to get this to work and assumes that all the steps listed on the site should work for all. It seems odd that simply copying a python script to the bin folder should allow it to become a recognised command without having to invoke the python interpreter every time.

Any help is appreciated.


回答1:


RabbitMQ decided to omit one vital piece of information.

Make the script executable with chmod +x otherwise it will fail to work.




回答2:


I spent several hours to figure out this, use rabbitmqadmin on linux environment, Finally below steps solve my issue.

On my ubuntu server, python3 was installed, I checked it using below command,

python3 -V

Step 1: download the python script to your linux server

wget https://raw.githubusercontent.com/rabbitmq/rabbitmq-management/v3.7.8/bin/rabbitmqadmin

Step2: change the permission

chmod 777 rabbitmqadmin

Step3: change the header of the script as below(first line)

#!/usr/bin/env python3

Thant's all, Now you can run below commands,

To list down queues,

./rabbitmqadmin -f tsv -q list queues

To Delete ques,

./rabbitmqadmin delete queue name=name_of_queue

To add binding between exchange and queue

./rabbitmqadmin declare binding source="exchangename" destination_type="queue" destination="queuename" routing_key="routingkey"



回答3:


After install Rabbbitmq on Ubuntu/Debian, you can activate the Rabbitmq Admin Portal using the next command:

rabbitmq-plugins enable rabbitmq_management

Then you can access to the portal from http://localhost:15672. Use the user/password "guest".




回答4:


I want to post my commands for installing rabbitmqadmin, it is combination of other answers, but with a little improvements for using best practice:

sudo rabbitmq-plugins enable rabbitmq_management
wget 'https://raw.githubusercontent.com/rabbitmq/rabbitmq-management/v3.7.15/bin/rabbitmqadmin'
chmod +x rabbitmqadmin
sed -i 's|#!/usr/bin/env python|#!/usr/bin/env python3|' rabbitmqadmin
mv rabbitmqadmin .local/bin/
rabbitmqadmin -q list queues

I suppose that you already create .local/bin/ dir and add it to PATH (on Ubuntu bash add this dir to PATH if it exists).



来源:https://stackoverflow.com/questions/36336071/install-rabbitmqadmin-on-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!