Oleksandr
Oleksandr

Reputation: 3764

Can we choose next master node in RabbitMQ?

Can we prefer one slave node to be a master than another slave node? Assuming I want to choose next master node to be a node with the minimum masters or with the maximum resource available if current master node fails. Is it possible to organize?

Upvotes: 0

Views: 3609

Answers (1)

Gabriele Santomaggio
Gabriele Santomaggio

Reputation: 22740

You can have a look the x-queue-master-locator policy. Read here: https://www.rabbitmq.com/ha.html

Queue Master Location Every queue in RabbitMQ has a home node. That node is called queue master. All queue operations go through the master first and then are replicated to mirrors. This is necessary to guarantee FIFO ordering of messages.

Queue masters can be distributed between nodes using several strategies. Which strategy is used is controlled in three ways, namely, using the x-queue-master-locator queue declare argument, setting the queue-master-locator policy key or by defining the queue_master_locator key in the configuration file. Here are the possible strategies and how to set them:

Pick the node hosting the minimum number of masters: min-masters Pick the node the client that declares the queue is connected to: client-local Pick a random node: random

I also suggest to read this post: https://www.erlang-solutions.com/blog/take-control-of-your-rabbitmq-queues.html

This should help you

Upvotes: 2

Related Questions