RabbitMQ supports clustering by default, but queues aren't replicated and are bound to the node on which they're created. I'm now looking for ways to make RabbitMQ highly available other than the DRBD solution that they've documented, because it seems like a waste of resources to reserve an entire server that's doing nothing but waiting for the active server to go down.
I'm thinking about a setup in which there are two queues. When a message is published, I want the RabbitMQ cluster to send the message to either of the two queues, whichever one is up. I know that the publisher will get an error if it tries to publish to a queue that's down and that the publisher can try again with the other queue, but I'm wondering whether this can be done automatically at the cluster level so that I don't have to write client code to handle it. Can this be done?
Recently RabbitMQ added active/active native support. http://www.rabbitmq.com/ha.html
Have a look at Alternate Exchanges.
It's basically what you asked for, but with exchanges instead of queues. The idea would be to publish to an exchange with an alternate exchange specified (you can do this with any of the RabbitMQ clients). If the message can be delivered to the first, it will. If not (because it can't be reached or because there are no queues bound to it), the alternate is used.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With