Course contentsShow
← System Design
Lesson 668 of 1,91918. Message Queues and BrokersFree lesson

RabbitMQ Clustering and High Availability

How RabbitMQ clusters work, queue mirroring, and achieving fault tolerance.

RabbitMQ Clustering and High Availability

What You'll Learn

You'll learn how RabbitMQ clusters ensure your messaging infrastructure survives node failures through clustering and queue mirroring.


The Core Idea

A single RabbitMQ node is a single point of failure. Clustering connects multiple RabbitMQ nodes together so they act as one logical broker, sharing metadata and providing redundancy. Queue mirroring (now called quorum queues in modern RabbitMQ) replicates queue data across nodes, ensuring messages aren't lost when a node crashes.

How Clustering Works

Think of a RabbitMQ cluster like a team of librarians sharing one catalog system:

  • Metadata is shared: All nodes know about exchanges, bindings, users, and permissions
  • Queue data is NOT automatically replicated: By default, each queue lives on one node only
  • Clients can connect to any node: The cluster routes requests internally

The Problem Without Mirroring

If Queue A lives on Node 1 and Node 1 dies, Queue A and all its messages are gone—even though Nodes 2 and 3 are still running.

Queue Mirroring: The Solution

Mirrored queues (classic feature) or quorum queues (modern, Raft-based) replicate queue contents across multiple nodes:

  • Messages are copied to 2+ nodes
  • If the primary node fails, a replica is promoted
  • Clients automatically reconnect and continue working

This achieves fault tolerance: the system survives individual node failures without message loss.

Cluster Sizing

Typically you deploy 3 or 5 nodes (odd numbers support majority quorum). With 3 nodes and quorum queues, you can lose 1 node and remain operational.


Key Takeaway:
RabbitMQ clustering shares metadata across nodes, but queue mirroring (or quorum queues) is required to replicate actual message data and achieve true high availability.