Restart RabbitMQ with clearing the Mnesia database

Restart RabbitMQ with clearing the Mnesia database

To restart RabbitMQ with clearing the Mnesia database:

  1. Stop RabbitMQ on nodes one by one:

    salt msg01* cmd.run 'systemctl stop rabbitmq-server'
    salt msg02* cmd.run 'systemctl stop rabbitmq-server'
    salt msg03* cmd.run 'systemctl stop rabbitmq-server'
    
  2. Remove the Mnesia database on all nodes:

    salt msg0* cmd.run 'rm -rf /var/lib/rabbitmq/mnesia/'
    
  3. Apply the rabbitmq state on the first RabbitMQ node:

    salt msg01* state.apply rabbitmq
    
  4. Apply the rabbitmq state on the remaining RabbitMQ nodes:

    salt -C "msg02* or msg03*" state.apply rabbitmq