I installed rabbitmqadmin
and was able to list all the exchanges and queues. How can I use rabbitmqadmin
or rabbitmqctl
to delete all the queues.
相关问题
- Error message 'No handlers could be found for
- RabbitMQ management plugin windows renders as blan
- Are topic exchanges the only exchanges that suppor
- Permission for sockets - android manifest
- RabbitMq refuses connection when run in docker
相关文章
- RabbitMQ with Unity IOC Container in .NET
- Install rabbitmqadmin on linux
- Spring AMQP single consumer parallelism with prefe
- Play Framework send message via rabbit mq
- Background jobs with Play Framework on Heroku
- RabbitMQ - Send message to a particular consumer i
- How to disable heartbeats with pika and rabbitmq
- Group received messages in RabbitMQ, preferably us
To list queues,
To delete a queue,
Here is a faster version (using
parallel
install sudo apt-get install parallel) expanding on the excellent answer by @admenvaparallel -j 50 rabbitmqadmin -H YOUR_HOST_OR_LOCALHOST -q delete queue name={} ::: $(rabbitmqadmin -H YOUR_HOST_OR_LOCALHOST -f tsv -q list queues name)
This commands deletes all your queues
This script is super simple because it uses
-f bash
, which outputs the queues as a list.Then we use
xargs -n1
to split that up into multiple variablesThen we use
xargs -I{}
that will run the command following, and replace{}
in the command.First, list your queues:
rabbitmqadmin list queues name
Then from the list, you'll need to manually delete them one by one:
rabbitmqadmin delete queue name='queuename'
Because of the output format, doesn't appear you can grep the response from
list queues
. Alternatively, if you're just looking for a way to clear everything (read: reset all settings, returning the installation to a default state), use:If you don't have rabbitmqadmin installed, try to purge queues with rabbitmqctl:
rabbitmqctl list_queues | awk '{ print $1 }' | xargs -L1 rabbitmqctl purge_queue
I made a deleteRabbitMqQs.sh, which accepts arguments to search the list of queues for, selecting only ones matching the pattern you want. If you offer no arguments, it will delete them all! It shows you the list of queues its about to delete, letting you quit before doing anything destructive.
If you want different matching against the arguments you pass in, you can alter the grep in line four. When deleting all queues, it won't delete ones with three consecutive spaces in them, because I figured that eventuality would be rarer than people who have rabbitmqctl printing its output out in different languages.
Enjoy!