[rabbitmq-discuss] Mechanism to Add Nodes to the Mirror Queue actively

Lujin clujin at gmail.com
Tue Apr 9 01:50:34 BST 2013


Hello RabbitMQ Devs,

In recent days, I've been experimenting with RabbitMQ's HA mechanism to get
messages mirrored to different nodes. I am concerned mainly with fail over
scenarios where the message would be lost if all the nodes for Queue X goes
down.

What I have observed is that as it is right now (3.0.0), the broker doesn't
actively find a node in the cluster to mirror the queue whenever a node
fails over.*

However, I have find a trick/bug/scheme I can employ to have a node added.

What I did was to have the following policies:
(In the scenario that I only want to mirror to 2 other nodes)

rabbitmqctl set_policy HA-1 "^two\." '{"ha-mode":"exactly","ha-params":2}' 1

rabbitmqctl set_policy HA-2 "^two\." '{"ha-mode":"exactly","ha-params":3}' 2

So from the beginning, upon creation,  a queue follows the HA-2 policy with
the highest priority which matched the "pattern". If that policy is
deleted, it will either default to a lower priority policy or none. In this
case it wouldn't matter, because there's a fail over. However, I noticed
that if I add a 'new' policy right afterwards, the queue will retroactively
follow the new policy!

So what I do is, whenever a node fails over, I immediately delete the HA-2
policy and then immediately add the same HA-2 policy right back. This is
the only way that I know of that allows the queue to pick up a node from my
cluster for mirroring. (Without bringing the node back up) Yes, the new
node will be unsynchronized but with active synchronization, this is not a
big problem.

*So my question is: Are there other ways for a mirrored queue to actively
find node(s) in the cluster to mirror to without some intricate steps like
the ones above? Perhaps there's a plugin in the works or some new feature
in a upcoming version relaese?

I look forward to hearing what interesting plans you guys have in store for
RabbitMQ!

Regards,
Lujin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130408/b2654d48/attachment.htm>


More information about the rabbitmq-discuss mailing list