Table of Contents
Hello learners, in this article we will be learning how to install RabbitMQ on Azure in detail. RabbitMQ is a prominent open source message broker that is utilised by both small businesses and large corporations throughout the world. With that in mind, let's get started!
Overview on RabbitMQ
RabbitMq is basically a messaging broker which can be said as a software where FIFO queues are defined. Applications connect to Rabbitmq in order to transfer a message or messages. A message can be any kind of information like a process or a task that should get started on another server or it could also be just a normal simple text message.It serves as an intermediary between web application servers & their users and also reduces the load and delivery times.
Benefits of RabbitMQ
- Reliability : RabbitMQ has wide range of features that let's you trade off with reliability , high availability , acknowledgments , publishing confirms and more..
- Complex Routing : Messages get routed through different exchanges before arriving at their queues. If you are looking for complex routing then you can always bind you exchanges together and even write your own exchange type as a plugin.
- Plugins Capability : RabbitMQ is loaded with wide variety of plugins which makes our tasks easier and if you feel the plugins which are loaded are not enough , then you can always write your own plugin and load them up.
- Management UI : It's UI which is very easy to use allows you to monitor and control every single aspect of your message broker.
- Delivery and Order Guarantee : The messages which should be sent to the consumer will be sent in the same order in which they were created
- Tracing : If you ever feel that your messaging broker is behaving weird then you can enable Firehose tracing which will let you find out what's going in the background.
- Redundancy : The Queue stores the messages until they are processed.
- Large Community : There is a large community for RabbitMQ producing all sorts of clients, plugins, guides, etc..
- Microsoft Azure account
- Basic knowledge of Linux commands
There are 2 ways to actually install Rabbit MQ on Azure
- Create individual Linux VM’s, Install RabbitMQ on it and Connect the RabbitMQ nodes installed in each VM.
- Install RabbitMQ Cluster package provided by Bitnami in Azure.
The first approach is actually time consuming since we have to create 3 different VM's and then connect the notes installed in each VM. But Azure makes our work easier by providing us a package which will do all the work for us , So I am going to teach you the second method through which you can easily install Rabbit MQ Cluster on Azure.
Install RabbitMQ on Azure
Step 1: Create a RabbitMQ Cluster in Azure
1. Login to the Azure Portal and navigate to Azure Marketplace.
2. Search for RabbitMQ cluster packaged by Bitnami and click on Create.
3. There are some options now which you will have to fill as below :
- Resource Group : Create a new Resource group to place your resources or use an existing one
- Deployment name : Name the Rabbit-MQ deployment as you want
- Location : Choose a location near to you for better latency
- No of Slaves : I would recommend to use 2 Slaves for HA.
- Application Password : RabbitMq password you want to set.
4.You can choose Authentication method as Password or SSH. But, If you want more security then you can opt for SSH. I have used an existing key , but you can always generate a new key for your instance.
5. Now,click on Create and wait for 5 minutes for the three Virtual Machine's to get created, One acting as a master and the other two as slaves.
SSH will be enabled by default on port 22 for all Virtual Machines.
Step 2: Connect to the Master Virtual Machine
1. Select the Master VM and connect it through SSH using the following command.
ssh -i <private-key-path> email@example.com
2. Now, install RabbitMQ management panel on the master node.
sudo rabbitmq-plugins enable rabbitmq_management
Step 3: Access the RabbitMQ Management Panel
1. Close the previous SSH session and access the RabbitMQ management panel by SSH Tunneling to our local host.
ssh -i <private-key-path> firstname.lastname@example.org -L 15672:127.0.0.1:15672
2. You can now access the RabbitMQ management panel through your browser using http://localhost:15672/.
Step 4: Configure the RabbitMQ settings
1. You can Configure the RabbitMQ settings properly on each of the Virtual Machine's using the following commands.
sudo vi /opt/bitnami/rabbitmq/etc/rabbitmq/rabbitmq.config --->Config file for RabbitMq sudo service bitnami start. --> Start bitnami sudo service bitnami stop --> Stop bitnami sudo rabbitmqctl cluster_status --->Find Cluster status
2.You can also access RabbitMQ Api from here : http://127.0.0.1:15672/api
Step 5 : Create new users in Rabbit MQ
1.Go to the Admin tab after you log in to the Management panel
2.You will find the Users tab on the right side , Click on it
3.Click on Add a user and enter the username and password for the user.
4.Later, assign the user a tag so that you can keep track of the user.
5.Finally, click on Add user and you will be able to see that the user will be created with the tag you have assigned to him.
In this article , we have learnt how we can use Azure Marketplace to install RabbitMQ on Azure. RabbitMq is very much needed by the organisations as a messaging broker. If you are just getting started in Azure, then please check out our other articles on Cloud. Please let us know if you encounter any issues on the commands above in the comments.