Partner with experts to accelerate your digital transformation journey
Bobcares

How to Set Up a 3 Node RabbitMQ Cluster HAProxy for High Availability

PDF Header PDF Footer

Deploy a 3 node RabbitMQ cluster HAProxy setup for high availability and fault tolerance.Our support team is always here to help you.

How to Set Up a 3 Node RabbitMQ Cluster HAProxy for High Availability

If you’re aiming for high availability and scalability in your messaging system, building a 3 node RabbitMQ cluster HAProxy is a proven solution. This setup3 node rabbitmq cluster haproxy ensures distributed message processing, fault tolerance, and efficient load handling. Let’s get straight to the point and walk through how it works, no unnecessary fluff.

What is a 3 Node RabbitMQ Cluster HAProxy?

A 3 node RabbitMQ cluster HAProxy combines RabbitMQ, a reliable open-source message broker, with HAProxy, a high-performance TCP load balancer. RabbitMQ is responsible for handling message storage, routing, and delivery. Meanwhile, HAProxy distributes incoming traffic across all nodes. As a result, this architecture provides resilience and keeps the system operational even if one or more nodes fail.

Step-by-Step Overview

  • RabbitMQ Cluster Setup

To begin, deploy RabbitMQ across three different nodes. Each node should run an independent RabbitMQ server instance. These nodes will communicate with one another to replicate queue data and maintain a synchronized state throughout the cluster.

Because of this built-in replication, all nodes share awareness of queues, bindings, and exchanges. Therefore, even if a single node becomes unavailable, the remaining ones can continue processing requests without data loss.

  • HAProxy Configuration

Once your RabbitMQ cluster is in place, the next step is to configure HAProxy as the load balancer. It will manage all incoming client traffic and evenly distribute connections to the three nodes.

Below is the exact configuration you can use with check [link] to monitor node health.

frontend rabbitmq_frontend
bind <frontend_address>:<frontend_port>
mode tcp
default_backend rabbitmq_backend
backend rabbitmq_backend
mode tcp
balance roundrobin
server rabbitmq_node1 <rabbitmq_node1_address>:<rabbitmq_node1_port> check
server rabbitmq_node2 <rabbitmq_node2_address>:<rabbitmq_node2_port> check
server rabbitmq_node3 <rabbitmq_node3_address>:<rabbitmq_node3_port> check

This setup is simple and effective. HAProxy listens on <frontend_address>:<frontend_port>, routes incoming connections through rabbitmq_frontend, and then forwards traffic to the rabbitmq_backend. Thanks to the roundrobin method, load distribution remains balanced across all nodes.

  • Client Connection and Message Processing

Clients connect directly to HAProxy’s frontend IP and port. In turn, HAProxy distributes those connections to any of the three RabbitMQ nodes.

Each node can handle both publishing and consuming messages. Furthermore, RabbitMQ’s clustering feature ensures that message data is consistent across the entire cluster. Clients don’t need to worry about which node they’re connected to, everything is handled transparently.

As messages arrive, they are routed based on the exchange bindings and queue rules defined within RabbitMQ. This design allows consumers to pull messages from any available node.

Messages are routed and delivered based on RabbitMQ’s internal rules and bindings. This allows consumers to pull messages from any node in the cluster.

  • Fault Tolerance and High Availability

If a node goes down due to planned maintenance or an unexpected failure, HAProxy automatically reroutes traffic to the other healthy nodes (source). As a result, your system continues processing messages without any disruption.

Using this, it eliminates single points of failure. It’s an ideal approach for production environments that demand consistent uptime and reliability.

[If needed, Our team is available 24/7 for additional assistance.]

Conclusion

This guide explained how a 3 node RabbitMQ cluster HAProxy can help build a resilient, scalable message system. From clustering RabbitMQ nodes to balancing traffic with HAProxy, the setup is straightforward yet powerful.

With this configuration, you’re not only enhancing fault tolerance but also improving system performance under load.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Get featured on the Bobcares blog and share your expertise with a global tech audience.

WRITE FOR US
server management

Spend time on your business, not on your servers.

TALK TO US

Or click here to learn more.

Speed issues driving customers away?
We’ve got your back!

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF