Open In App

What is Virtual Host in Rabbitmq

Last Updated : 08 Jul, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

RabbitMQ is a multi-tenant system in which virtual hosts, or logical groups of entities, control connections, exchanges, queues, bindings, user permissions, policies, and other aspects. The concept is similar to that of Apache virtual hosts and Nginx server blocks. RabbitMQ allows a variety of choices for defining how messages are routed from the publisher to one or more consumers. Virtual Hosts in RabbitMQ allow you to separate apps utilizing the same RabbitMQ instance. RabbitMQ vhosts define a logical grouping of connections, exchanges, queues, bindings, user permissions, and so on within an instance.

What is a Virtual Host?

A virtual host is a hosting service provider that specializes in virtual infrastructure solutions such as virtual servers, computers, storage, and other hybrid platforms that allow for the hosting of applications, data, and services. Shared web hosting is a widely utilized application. Shared web hosting is less expensive than dedicated web hosting since multiple clients can be hosted on a single server. It is also usual for a single company to desire to use numerous domains on the same system so that the names represent the services provided rather than the location where those services are hosted.

Virtual Hosts and Client Connections

A virtual host has a name. When an AMQP 0-9-1 client joins to RabbitMQ, it specifies the host to connect to. If authentication is successful and the username provided is allowed permission to the host, the connection is formed.

Connections to a host can only access exchanges, queues, bindings, and other host-specific resources. For example, an application can consume from one host and then republish to the other. This scenario can involve vhosts from multiple clusters or the same cluster (or just one node). The RabbitMQ Shovel plugin is an example of such an application.

How to Create a Virtual Host in rabbitmq

Step 1: Log in to Virtual Host

First, you need to log in to this and once logged in to the rabbitmq, click on the 'Admin', then tap on 'Virtual Hosts".

Log in to Virtual Host

Step 2: Add a new virtual host

Click 'Add a new virtual host' and give it an acceptable name. To set up the new virtual host, click the 'Add virtual host' option.

 Add a new virtual host

Step 3: Create a New User

On the Users tab, tick the 'Add a user' box. Then, you may create a username and password for the new user, as well as provide the user access to the Admin (GUI) interface, by clicking the 'Add User' option.

Create a New User

Step 4: Assign the New User to the Virtual Host

At last, you have to locate and click on the previously created user.

rabbitmq4

Conclusion

In this article, we have learned about Virtual hosts in rabbitmq. Virtual hosts in rabbitmq enable the logical grouping and separation of resources. The separation of physical resources is not an objective of virtual hosts, albeit certain resources may be limited for specific virtual hosts.


Next Article
Article Tags :

Similar Reads