- 18 Nov 2024
- 4 Minutes to read
- Print
- PDF
Install RabbitMQ on Windows
- Updated on 18 Nov 2024
- 4 Minutes to read
- Print
- PDF
RabbitMQ is a robust and widely used open-source message broker software that facilitates message queuing between applications. Developed using the Erlang programming language, RabbitMQ supports multiple messaging protocols such as AMQP (Advanced Message Queuing Protocol), MQTT, and STOMP. It acts as an intermediary, enabling different components of distributed systems to communicate asynchronously via queues. Messages are produced by publishers and consumed by subscribers, ensuring reliable delivery and decoupling of applications. RabbitMQ's features include message durability, flexible routing, clustering for high availability, and a management interface for monitoring and administration. It is favored for its scalability, reliability, and support for various integration patterns in modern software architectures.
Install RabbitMQ
To install RabbitMQ (Version 3.2.18), perform the following steps:
- Download and install the latest version of the programming language Erlang from the below link as per the requirements.
http://www.erlang.org/downloads - After downloading the latest version of Erlang, to install Erlang double click on the downloaded file and select the options shown in the screenshot.
Figure: Erlang setup - After Erlang is installed, install RabbitMQ on windows from the below link.
https://www.rabbitmq.com/download.html - After opening the URL, the RabbitMQ setup files are displayed as below. Install a RabbitMQ server on windows as shown.
Figure: Install RabbitMQ on windows - After the setup file is downloaded, double click on the setup file to install RabbitMQ on Windows.
Figure: RabbitMQ setup - After RabbitMQ is installed, to check the status of RabbitMQ, search for RabbitMQ Command Prompt and open it with admin privilege.
- After the command prompt is open, enter the command “rabbitmqctl status” and click enter to check the status of RabbitMQ server.
Enabling RabbitMQ Management Plugin
After downloading and installing the Erlang OTP and RabbitMQ, enable the RabbitMQ Management Plugin as follows:
- Open the Command Prompt in Administrator mode.
- Go to the RabbitMQ install location: [C:\Program Files (x86) \RabbitMQ Server\rabbitmq_server-3.2.3\sbin]
- Enter the following command that is highlighted: [C:\Program Files\RabbitMQ Server\rabbitmq_server-3.8.2\sbin>rabbitmq-plugins enable rabbitmq_management]
- The above-mentioned command runs the rabbitmq-plugins batch file that is located inside the sbin folder.
- Restart the RabbitMQ service.
Figure: Command prompt
Configuring RabbitMQ Admin Portal
To configure the RabbitMQ Admin Portal:
- Open the browser and enter the URL.
http://localhost:15672/ - Specify the Username and Password.
Figure: Localhost loginNoteBy default, the Username and Password are guest. - After logging in, create a Username and Password.
Figure: Admin
1. Click Admin.
2. Provide the username and password.
3. Select the Tags as Admin from the dropdown.
4. Click Add User.
- Select the newly created User in the Grid.
- Specify the Permissions with default values.
- Guest credentials cannot be used remotely.
- Username is case sensitive.
Create Virtual Host
To create virtual host, perform the following steps:
- Log in to the RabbitMQ web management portal with the default guest credentials.
Figure: Web management portal - Click Admin tab. In this section choose "Virtual Hosts" from the vertical menu.
Figure: Admin tab - After selecting "Virtual Hosts" the default "Virtual Hosts" are displayed which are already created.
- Click “Add a new virtual host” to create a new virtual host.
Figure: Add a new virtual host - Enter the name of the virtual host as "demohost". Click Add Virtual Host to create "demohost" virtual host.
Figure: Name of the virtual host - After adding the virtual host, it is displayed in "All virtual hosts" panel.
Figure: All virtual hosts
Assign Virtual Hosts to Users
After creating a virtual host, users must be assigned to the virtual hosts. Users must be created with the required privileges and assign a virtual host for the user.
To create a new user, perform the following steps:
- On the RabbitMQ web management portal, navigate to Admin. On the vertical menu, select Users.
Figure: Create user - Click Add a User. Create a new user with the username "virtualuser" by setting a password as "123456".
Click Admin to set the tag as Administrator. Click Add User to add the newly created user.
Figure: Add a user - After the user is created, the newly created username is displayed in All Users panel.
- For the newly created user "virtualuser", the “Can access virtual hosts” column has a value of “No access” which means the user doesn’t have the privilege to access any virtual hosts.
Figure: User details - To set permission for users to access the virtual host, click the username "virtualuser". Navigate to the Permissions panel above the Overview panel.
- Select the required virtual host from the dropdown and click Set permission.
Figure: Set permissions - The default value ".*" allows the user to access all exchanges and queues in the virtual host. After the permission is set, you’ll see the “Current permission”.
Figure: Current permission - The newly created user "virtualuser" has permission to login into RabbitMQ web management.
- Login into RabbitMQ web management plugin with the new user “virtualuser”.
Figure: New user login - Below is the snapshot after logging into RabbitMQ web management plugin with the new user “virtualuser”.
Figure: Web management portal
Configuring Firewall Rules
To configure the Firewall Rules, perform the following steps:
- Add Inbound Rules to connect to RabbitMQ remotely.
- Specify the following ports: 15672,5672,5671.
- Ensure the following Port details:
- RabbitMQ Management: 15672
- http Port: 5672 (Without TLS Enabled)
- Required SSL :5671 (With TLS Enabled)
Figure: TLS enabled