[rabbitmq-discuss] RabbitMQ and Warrens

Francesco Mazzoli francesco at rabbitmq.com
Wed Aug 22 13:28:11 BST 2012


Hi Adam,

At Tue, 14 Aug 2012 00:59:28 -0700 (PDT),
Adam Petrovic wrote:
> Hi. I am just reading up about the concept of HAProxy load-balanced warrens
> (active / standby nodes) and I can't quite come up with a solution to a
> bugging question.
> 
> I understand that the concept of the load balanced warren is for HAProxy to
> automatically fail over to the standby node, should the active node fail and
> go down. In doing so, any existing messages on the active node would be lost
> until this node is brought back up.
> 
> Which brings me to my question, what happens to the pending (still to be
> consumed) messages on the standby node when the active node is brought back
> up.  Are they lost, or should the application logic handle this itself?
> Because as far as I know, HAProxy has no way of dealing with this issue.

The first thing you should do is make sure that you need this kind of
active/passive configuration.  If your cluster resides in a local network, you
might want to look at RabbitMQ own clustering, which will let you connect to any
node in the cluster seamlessly, see <http://www.rabbitmq.com/clustering.html>.

Otherwise, I'm don't know much HAProxy, but a good option in this situation
would be to instruct HAProxy to promote the standby node to active node when the
active fails, and make the once-active node a standby node when it comes back
up.  This has the converse problem of what to do with the messages left on the
active node.

If that's not possible, you might want to look for a way to instruct HAProxy to
notify you when the active node comes back up, stop publishing, wait for all the
messages to be consumed on the stanby node, tell HAProxy to restore the active
node, and then start publishing again.  But that's tricky, especially the "wait
for messages to be consumed" part.

--
Francesco * Often in error, never in doubt


More information about the rabbitmq-discuss mailing list