queuerabbitmq

Deleting queues in RabbitMQ


I have a few queues running with RabbitMQ. A few of them are of no use now, how can I delete them? Unfortunately I had not set the auto_delete option.

If I set it now, will it be deleted?

Is there a way to delete those queues now?


Solution

  • If you do not care about the data in management database; i.e. users, vhosts, messages etc., and neither about other queues, then you can reset via commandline by running the following commands in order:

    WARNING: In addition to the queues, this will also remove any users and vhosts, you have configured on your RabbitMQ server; and will delete any persistent messages

    rabbitmqctl stop_app
    rabbitmqctl reset
    rabbitmqctl start_app
    

    The rabbitmq documentation says that the reset command:

    Returns a RabbitMQ node to its virgin state.

    Removes the node from any cluster it belongs to, removes all data from the management database, such as configured users and vhosts, and deletes all persistent messages.

    So, be careful using it.