What Are Quorum Queues?
- Quorum Queues are distributed queues built on the Raft consensus algorithm.
- They are designed for high availability, durability, and data safety by replicating messages across multiple nodes in a RabbitMQ cluster.
- Its a replacement of Mirrored Queues.
Key Characteristics
- Replication:
- Messages are replicated across a quorum (a majority of nodes).
- A quorum consists of an odd number of replicas (e.g., 3, 5, 7) to ensure a majority can elect a leader during failovers.
- Leader-Follower Architecture:
- Each Quorum Queue has one leader and multiple followers.
- The leader handles all write and read operations, while followers replicate messages and provide redundancy.
- Durability:
- Messages are written to disk on all quorum nodes, ensuring persistence even if nodes fail.
- High Availability:
- If the leader node fails, RabbitMQ elects a new leader from the remaining quorum, ensuring continued operation.
- Consistency:
- Quorum Queues prioritize consistency over availability.
- Messages are acknowledged only after replication is successful on a majority of nodes.
- Message Ordering:
- Message ordering is preserved during normal operations but may be disrupted during leader failovers.
Use Cases
- Mission-Critical Applications β Systems where message loss is unacceptable (e.g., financial transactions, order processing).
- Distributed Systems β Environments requiring high availability and fault tolerance.
- Data Safety β Applications prioritizing consistency over throughput (e.g., event logs, audit trails).
Setups
Using rabbitmqctl
rabbitmqctl add_queue quorum_queue --type quorum
Using python
channel.queue_declare(queue="quorum_queue", arguments={"x-queue-type": "quorum"})
References:
- https://www.rabbitmq.com/docs/quorum-queues
-