RabbitMQ: List | Create vHosts – Rabbitmqctl

Virtual hosts or vHosts in RabbitMQ allow to segregate applications using the same RabbitMQ instance by providing logical grouping and separation of resources.

If you are familiar with virtual hosts in Apache or server blocks in Nginx, the idea is similar.

In this note i will show how to list, create and delete virtual hosts in RabbitMQ from the command-line using the rabbitmqctl command.

vHosts in RabbitMQ – List, Create, Delete

Default vHost: The name of the default virtual host in RabbitMQ is "/".

List all virtual hosts:

$ rabbitmqctl list_vhosts

Create a virtual host:

$ rabbitmqctl add_vhost <vhostName>

Delete a virtual host:

$ rabbitmqctl delete_vhost <vhostName>