Search code examples
rabbitmqmessage-queuehigh-availabilityrabbitmqctl

Combine ha-mode with queue-master-locator in a RabbitMQ cluster


In a RabbitMQ cluster, I know that the queues can be created with their masters on different nodes, using the "min-masters" strategy of the "queue_master_locator" policy. This would mean that the queues are no longer mirrored(ha-mode policy cant be applied), as only one policy can be applied at a time. Is there a way to accomplish both? I basically want to have the queues distributed across cluster nodes, so the memory footprint on a single node is reduced.


Solution

  • queue_master_locator=min-masters policy means that the master queue node is automatically assigned using the rabbitmq node with less masters.

    This is not related to ha-mirror policy.

    you have 3 ways to solve the problem:

    1. create a single policy with both the features in this way:enter image description here

    2. create only the ha policy and add the arg x-queue-master-locator to each single queue: enter image description here

    3. create only the ha policy and use the rabbitmq config file to define the x-queue-master-locator, see here for more details: https://www.rabbitmq.com/configure.html#configuration-file

    Also suggesto to read this blog post about that.