<div dir="ltr"><div><div><div><div>Hello RabbitMQ Devs,<br><br></div>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. <br>
<br>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.*<br><br></div>However, I have find a trick/bug/scheme I can employ to have a node added.<br>
<br></div>What I did was to have the following policies: <br>(In the scenario that I only want to mirror to 2 other nodes)<br></div><div><pre>rabbitmqctl set_policy HA-1 "^two\." '{"ha-mode":"exactly","ha-params":2}' 1<br>
rabbitmqctl set_policy HA-2 "^two\." '{"ha-mode":"exactly","ha-params":3}' 2<br></pre>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!<br>
<br>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.<br>
<br></div><div>*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?<br>
<br></div><div>I look forward to hearing what interesting plans you guys have in store for RabbitMQ!<br><br></div><div>Regards,<br></div><div>Lujin<br></div></div>