Menu Search

1.14. Queue Replication with the HA module

As well as support for an active-passive cluster, the ha module also allows you to replicate individual queues. The original queue is used as normal. The replica queue is updated automatically as messages are added to or removed from the original queue.

To create a replica you need the HA module to be loaded on both the orignal and replica brokers. Note that it is not safe to modify the replica queue other than via the automatic updates from the original. Adding or removing messages on the replica queue will make replication inconsistent and may cause message loss. The HA module does not enforce restricted access to the replica queue (as it does in the case of a cluster) so it is up to the application to ensure the replca is not used until it has been disconnected from the original.

Suppose that myqueue is a queue on node1 and we want to create a replica of myqueue on node2 (where both brokers are using the default AMQP port.) This is accomplished by the command:

      qpid-config --broker=node2 add queue --start-replica node1 myqueue

If myqueue already exists on the replica broker you can start replication from the original queue like this:

      qpid-ha replicate -b node2 node1 myqueue