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
I tried the above pieces of code but I did not do any streaming.
sudo rabbitmqctl list_queues | awk '{print $1}' > queues.txt; for line in $(cat queues.txt); do sudo rabbitmqctl delete_queue "$line"; done
.I generate a file that contains all the queue names and loops through it line by line to the delete them. For the loops,
while read ...
did not do it for me. It was always stopping at the first queue name.You can use rabbitmqctl eval as below:
The above will delete all empty queues in all vhosts that have a name beginning with "prefix-". You can edit the variables IfUnused, IfEmpty, and MatchRegex as per your requirement.
Okay, important qualifier for this answer: The question does ask to use either rabbitmqctl OR rabbitmqadmin to solve this, my answer needed to use both. Also, note that this was tested on MacOS 10.12.6 and the versions of the rabbitmqctl and rabbitmqadmin that are installed when installing rabbitmq with Homebrew and which is identified with
brew list --versions
as rabbitmq 3.7.0rabbitmqctl list_queues -p <VIRTUAL_HOSTNAME> name | sed 1,2d | xargs -I qname rabbitmqadmin --vhost <VIRTUAL_HOSTNAME> delete queue name=qname
With
rabbitmqadmin
you can remove them with this one-liner:There's a way to remove all queues and exchanges without scripts and full reset. You can just delete and re-create a virtual host from admin interface. This will work even for vhost
/
.The only thing you'll need to restore is permissions for the newly created vhost.