15

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?

Hongli
  • 18,682
  • 15
  • 79
  • 107

3 Answers3

15

Recently RabbitMQ added active/active native support. http://www.rabbitmq.com/ha.html

Vadym Chekan
  • 4,977
  • 2
  • 31
  • 24
  • How would this better then an Alternate Exchange ? – guiomie Jul 09 '13 at 21:12
  • 1
    @guiomie, in Alternative Exchange, if master node goes down, all messages are gone. Active/active configuration will copy every message to spare server when it is sent to master. – Vadym Chekan Jul 10 '13 at 03:04
6

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.

slang
  • 626
  • 7
  • 26
scvalex
  • 14,931
  • 2
  • 34
  • 43
5

High-availability aka "mirrored" queues are the gold standard for Rabbit HA.

Chris Johnson
  • 20,650
  • 6
  • 81
  • 80