Learn Labs
Queue Types

Quorum Queues

Replicated queues on Raft: leaders, members, failover, and their limits

A classic queue lives on one node. If that node dies, the queue is unavailable, and if its disk is lost, the messages are gone. A quorum queue is replicated across several nodes using the Raft consensus algorithm, the same family of protocol as Kafka's KRaft and Redis Cluster's failover. It's the default queue type in this cluster (default_queue_type = quorum).

How it works

Each quorum queue has a leader replica and followers on other nodes. Every operation (enqueue, ack) is an entry in a Raft log, committed once a majority of members have written it.

publishforward / replicatereplicatedeliverpublisheron rabbit-1consumeron rabbit-3rabbit-1followerrabbit-2leader: lab.harabbit-3followera write commits once 2 of 3 have it; lose the leader and a follower takes over
docker exec rabbit-1 rabbitmqctl -q list_queues -p shop name type leader members
orders.billing  quorum  rabbit@rabbit-2  [rabbit@rabbit-2, rabbit@rabbit-1, rabbit@rabbit-3]

docker exec rabbit-1 rabbitmq-queues quorum_status orders.billing --vhost shop
Node Name        Raft State  Membership  Last Log Index  Last Written  ...
rabbit@rabbit-1  follower    voter       4               4
rabbit@rabbit-2  leader      voter       4               4
rabbit@rabbit-3  follower    voter       4               4
  • A publish is confirmed when a majority (2 of 3) has it.
  • Consumers can connect to any node; the cluster forwards to the leader.
  • With 3 members, the queue tolerates one node failure; with 5, two.

Failover under load

labs/quorum_failover.py publishes with confirms in a loop. Stopping the leader's node mid-run:

docker compose -f compose_prod.yaml run --rm labs python quorum_failover.py
# in another terminal: find and stop the leader of lab.ha
docker stop rabbit-1

connected to rabbit-1
connection lost (ConnectionClosedByBroker); reconnecting...
connected to rabbit-2
confirmed 3246, queue holds 3248  (count >= confirmed: nothing confirmed was lost)

A follower was elected leader within seconds; the publisher reconnected to another node and carried on. Every confirmed message survived. The queue holds 2 more than were confirmed: messages that reached the broker but whose confirms were lost with the connection, so the publisher can't know they arrived. If it retried them, they'd be duplicates. At-least-once again.

publisherrabbit-1 (leader)rabbit-2publish + confirm x3000docker stop rabbit-1rabbit-2 elected leaderreconnectpublish + confirm x2463,246 confirmed; 3,248 stored

Membership

The number of replicas is the queue's membership. It's set when the queue is declared (x-quorum-initial-group-size, default: up to 3 nodes) and can be changed:

rabbitmq-queues add_member orders.billing rabbit@rabbit-3 --vhost shoprabbitmq-queues delete_member orders.billing rabbit@rabbit-3 --vhost shoprabbitmq-queues grow rabbit@rabbit-4 alladd a new node to every quorum queuerabbitmq-queues rebalance quorumspread leaders evenly across nodes

This cluster sets quorum_queue.continuous_membership_reconciliation so membership is restored automatically, after the one-member surprise during setup.

What quorum queues don't do

FeatureClassicQuorum
ReplicationNo (single node)Yes, Raft
Non-durable / exclusiveYesNo: always durable
Message prioritiesYesTwo levels (normal and high) since 4.0
Per-message TTLYesYes (since 3.10)
Poison message handlingManualBuilt-in delivery limit
Memory useLowerHigher: keeps a Raft log, snapshots
Throughput per queueHigherLower: every write goes to a majority

Use classic queues for temporary, non-critical, or exclusive queues (RPC replies, a live dashboard's feed), and quorum queues for anything that must survive a node failure.

Lab

  1. Run quorum_failover.py and stop the leader's node as shown. Note how long publishing paused.
  2. Run rabbitmq-queues quorum_status lab.ha --vhost shop before and after.
  3. Stop two nodes. Can you still publish to lab.ha? Consume? Start them again and watch it recover.
  4. Run rabbitmq-queues rebalance quorum and check the leaders with list_queues name leader.

On this page