[rabbitmq-discuss] Doubt regarding rabbit servers in clustered environment
Marek Majkowski
majek04 at gmail.com
Fri Nov 19 17:04:05 GMT 2010
On Fri, Nov 19, 2010 at 16:46, Kshitiz Garg <stephanion2002 at gmail.com> wrote:
> Thanks for the reply Mark,
>
> In our case, we
>
> 1. Create two exchanges A and B
> 2. Create 8 queues a,b,c,d,e,f,g,h
> 3. Bind A,B to these queues.
> 4. Consumer is listening to a,b,c,d,e,f,g,h ......
> 5. For the above operations, we are using two Rabbit MQ nodes in clustered
> mode.
>
> Please let us know the behaviour of clustered RabbitMQs ....
>
> Also, I could not understand the statement "all the traffic to a queue gets
> forwarded to one particular node." (we send the messages to an exchange and
> not a queue, isn't it ?)
Right. I said it's complex :)
All the metadata lives in a replicated Erlang database (mnesia). That includes:
exchanges, bindings, credentials and so on.
So, if you update anything of that - it will be immediately visible
in the whole cluster. In other words: when you create an exchange
A on node 1, that will automatically create exchange A on node 2.
Now, with queues that's more complex. When you connect to node 1
and do queue_declare(xx), you are actually creating a queue on
that particular node. This information (queue xx is created on node 1)
is shared with other nodes. All the nodes know that a location of
queue xx is node1.
Whenever you publish stuff, to whatever node, the message
is pushed to a local exchange (as mentioned before, exchanges
are 'copied' to every node). Next step after the exchange
is the binding. The bindings are also 'copied' to all the nodes.
At that point the node knows: this message should go to a queue xx.
The node looks up where the queue lives and pushes a message to
a particular node that holds queue xx.
So, once again: exchanges and bindings are replicated, they
are the same for every node in the cluster.
Queue on the other hand lives on a particular node (actually
on the node that 'queue_declare' was executed).
Clustering != HA
(the messages (queue contents) live on a single node)
(I'm sure my friends from the team will clarify if I got the details wrong)
Is this description any better?
Cheers,
Marek
More information about the rabbitmq-discuss
mailing list