# FAQ: How to reset the RabbitMQ broker?

By Lovisa Johansson. Published 14 May 2020.

In some cases, you just need to wipe everything off from your RabbitMQ server and start over. Despite being extremely stable, in some rare circumstances, you will need to completely reset RabbitMQ after encountering errors such as corrupt data, nodes permanently separated from the cluster, or an unmanageably large broker.

The simple answer is to delete and recreate the vhost, that will permanently clear all entities like queues, policies, bindings, etc. So let’s start to tell how to do that, followed by information on how to use the _reset_ and _force_reset_ command.

## Recreate the virtual host from the command line

You do not need to reset a RabbitMQ node to remove corrupted data. Dropping a virtual host removes data from the database while maintaining the cluster state and user information.

Enter the following commands to drop a vhost named _reset_vhost:_

```javascript
delete_vhost reset_vhost
add_vhost reset_vhost
```

These commands simply drop and add the _reset_vhost._ All related queues, exchanges, and messages drop from the broker without affecting users.

## Recreate the virtual host from the management console

The management console allows administrators to delete and create virtual hosts without using the command line. If using CloudAMQP, you will need a dedicated plan to access the _Admin tab._ As an example we have have a queue _reset_queue,_ and an attached exchange, _reset_exchange._

The queue and exchange reside under the vhost named _reset_vhost_ as shown in the figure below:

![](/img/blog/reset-vhost.png)

Click on the vhost _reset_vhost_ at the _/vhosts_ path and then on the _Delete this Virtual Host_ button at the bottom of the page. Click ok if prompted by RabbitMQ.

![](/img/blog/reset-rabbitmq-broker.png)

The broker will drop the vhost and any related structure. The action does not affect the attached users, it merely removes the vhost.

## How do I reset my RabbitMQ node?

RabbitMQ offers the _reset_ and _force_reset_ command through [rabbitmqctl](https://www.rabbitmq.com/rabbitmqctl.8.html) to reset a single node. Open a new shell on the server hosting the node and type the following commands to gracefully reset the server:

```javascript
rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl start_app
```

You must stop the server to use this command, restarting once complete. The broker drops all virtual hosts, queues, exchanges, and non-administrative users. RabbitMQ attempts to gracefully exit without damaging an existing cluster or broker, returning to a virgin state.

## What do I do if my RabbitMQ cluster becomes corrupted?

If your cluster is corrupted or irreparably split, use force_reset instead of reset. This will automatically drop your queues, exchanges, and configurations. Run the following from a command-line shell on the target node:

```javascript
rabbitmqctl stop_app
rabbitmqctl force_reset
rabbitmqctl start_app
```

You still need to stop and restart the application. Only use this command as a last resort, when the database or cluster is corrupted, as there is no attempt to notify other nodes. Any reset command results in the removal of all users except for the administrative user and any messages.

## What happens if I drop a vhost on a cluster node?

Clusters attempt to synchronize information. If you reset a virtual host, the action propagates across the cluster. All brokers drop related queues, exchanges, and messages as well. Resetting a node drops it from the cluster. The vhost and related information remain on the cluster. You will need to drop vhosts on the cluster as needed. If you do not drop the vhost, it is recreated when rejoining the cluster.

## Feedback

If you have any questions, suggestions, comments, or even a stuck rabbit, please comment below and we will get back to you.
