Clustering, mirrored queues and quorum queues
A classic queue lives on one node; quorum queues replicate it with Raft, and mirroring is gone.
Open this lesson in the learning hubKey points
- Cluster nodes share users, vhosts and definitions, but a classic queue lives on exactly one node.
- Nodes that do not host the queue proxy to the node that does, so queue placement affects latency.
- Classic mirroring used ha-mode policies, could lose confirmed messages on failover, and 4.0 removed it.
- Quorum queues arrived in RabbitMQ 3.8 and use Raft, so a write needs a majority of the replicas.
- Three replicas tolerate one node loss and five tolerate two, so always pick an odd replica count.
- Erlang clustering uses port
25672and epmd on4369, which are not the AMQP port.
Example
rabbitmq-diagnostics cluster_status
# quorum is a queue argument, chosen at declare time
rabbitmqadmin declare queue name=orders durable=true \
arguments='{"x-queue-type":"quorum","x-delivery-limit":10}'
# who is the Raft leader, and are all replicas in sync?
rabbitmq-queues quorum_status orders
# add a replica on a new node, then rebalance leaders
rabbitmq-queues grow rabbit@node3 all
rabbitmq-queues rebalance quorum
Quorum queues for work that must not be lost, streams for replay, classic for cheap and disposable.
This is a reading copy. The full lesson — with the visual explainer, the interactive lab and a Run button for the code — lives in the RabbitMQ Course course, and every lesson in it is listed on the RabbitMQ Course contents page.