How to Setup RabbitMQ Cluster on Ubuntu 18.04 LTS

In this blog post, we will discuss the process of Setup RabbitMQ Cluster on Ubuntu 18.04. RabbitMQ is an open source message broker software that implements the Advanced Message Queuing Protocol (AMQP) and Streaming Text Oriented Messaging Protocol, Message Queuing Telemetry Transport, and other protocols via a Plugins.

The work of a Messaging broker is to receive messages from publishers (applications that publish them) and route them to consumers (applications that process them). AMQP is a messaging protocol that enables conforming client applications to communicate with conforming messaging middleware brokers.

By setting a RabbitMQ cluster on Ubuntu 18.04, you avoid a single point of failure and achieve higher throughput when compared to single instance RabbitMQ setup. Without further ado, let’s dive to RabbitMQ cluster setup on Ubuntu 18.04 LTS

Setup Requirements

This setup has the following requirements

Installed Ubuntu 18.04 LTS servers

At least two RabbitMQ servers

A user with sudo privileges

The servers should have internet access

This setup of RabbitMQ Cluster on Ubuntu 18.04 is based on two servers with the following IP addresses and hostnames.

Server

Hostname

IP Address

MQ Server 1

mq1.example.com

192.168.121.11

MQ Server 2

mq2.example.com

192.168.121.8

Step 1: Setup Hostnames and DNS

The first step in the installation of the RabbitMQ cluster on Ubuntu 18.04 is to configure correct hostnames and DNS.

MQ Server 1:

sudo hostnamectl set-hostname mq1.example.com --static

MQ Server 2:

sudo hostnamectl set-hostname mq2.example.com --static

If you don’t have a DNS server, you can add the records to the /etc/hosts file