Install RabbitMQ
  • 09 Aug 2024
  • 4 Minutes to read
  • PDF

Install RabbitMQ

  • PDF

Article summary

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:

  1.  Download and install the latest version of the programming language Erlang from the below link as per the requirements.
    http://www.erlang.org/downloads
  2.  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

  3.  After Erlang is installed, install RabbitMQ on windows from the below link.
    https://www.rabbitmq.com/download.html

  4.  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
  5. After the setup file is downloaded, double click on the setup file to install RabbitMQ on Windows.
    Figure: RabbitMQ setup

  6.  After RabbitMQ is installed, to check the status of RabbitMQ, search for RabbitMQ Command Prompt and open it with admin privilege.
  7. 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:

  1.  Open the Command Prompt in Administrator mode.
  2.  Go to the RabbitMQ install location: [C:\Program Files (x86) \RabbitMQ Server\rabbitmq_server-3.2.3\sbin]
  3.  Enter the following command that is highlighted: [C:\Program Files\RabbitMQ Server\rabbitmq_server-3.8.2\sbin>rabbitmq-plugins enable rabbitmq_management]
  4. The above-mentioned command runs the rabbitmq-plugins batch file that is located inside the sbin folder.
  5.  Restart the RabbitMQ service.
    Figure: Command prompt

Configuring RabbitMQ Admin Portal

To configure the RabbitMQ Admin Portal:

  1.  Open the browser and enter the URL.
    http://localhost:15672/

  2. Specify the Username and Password.
    Figure: Localhost login
    Note
    By default, the Username and Password are guest.

  3.  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.
                                                               
  4.  Select the newly created User in the Grid.
  5.  Specify the Permissions with default values.
  6. Guest credentials cannot be used remotely.
  7. Username is case sensitive. 

Create Virtual Host

To create virtual host, perform the following steps: 

  1.  Log in to the RabbitMQ web management portal with the default guest credentials.
    Figure: Web management portal

  2.  Click Admin tab. In this section choose "Virtual Hosts" from the vertical menu.
    Figure: Admin tab

  3.  After selecting "Virtual Hosts" the default "Virtual Hosts" are displayed which are already created.

  4.  Click “Add a new virtual host” to create a new virtual host.
    Figure: Add a new virtual host

  5.  Enter the name of the virtual host as "demohost". Click Add Virtual Host to create "demohost" virtual host.
    Figure: Name of the virtual host

  6.  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:

  1.  On the RabbitMQ web management portal, navigate to Admin. On the vertical menu, select Users.
    Figure: Create user

  2.  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

  3.  After the user is created, the newly created username is displayed in All Users panel.

  4.  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

  5.  To set permission for users to access the virtual host, click the username "virtualuser". Navigate to the Permissions panel above the Overview panel.

  6.  Select the required virtual host from the dropdown and click Set permission. 
    Figure: Set permissions

  7.  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

  8.  The newly created user "virtualuser" has permission to login into RabbitMQ web management.

  9. Login into RabbitMQ web management plugin with the new user “virtualuser”.
    Figure: New user login

  10.  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:

  1.  Add Inbound Rules to connect to RabbitMQ remotely.
  2. Specify the following ports: 15672,5672,5671.
  3.  Ensure the following Port details: 
    1. RabbitMQ Management: 15672 
    2. http Port: 5672 (Without TLS Enabled)
    3.  Required SSL :5671 (With TLS Enabled)
      Figure: TLS enabled




Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.