activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Mielke <tors...@fusesource.com>
Subject Re: ActiveMQ Master/Slave Pair with Network of Brokers
Date Thu, 18 Oct 2012 11:59:04 GMT
Answers in line
On Oct 17, 2012, at 9:23 AM, ndmigration wrote:

> Hello,
> 
> I was able to set up Network of Brokers with store and forward strategy and
> working fine. I was given bigger machines now and would like to set up
> Master/Slave pair within the network of brokers. I understand Masters don't
> need any config changes but Slaves should indicate its corresponding master
> with URI. However, I'm not very clear on what uri to specify in the client.
> I'm using 5.6 release.

There are different types of master slave as documented in 
http://fusesource.com/docs/broker/5.5/clustering/front.html and
http://activemq.apache.org/masterslave.html

Only in Pure Master Slave scenario needs the slave to know about the master and needs a connection
to the master. 
Pure Master Slave isn't really recommended due to the outlined limitations.
Its better to go with shared file system master/slave or jdbc master/slave if that is possible.
In these cases the slave is not configured any differently than the master.


> For example: Two machines with MasterA, SlaveB on 1 machine, and MasterB,
> SlaveA on another machine. No Network connectors between Masters and Slaves
> but network connectors between MasterA and MasterB. I hope that I'm right
> till this point. What about client uri? I'm currently using nio protocol at
> the clients like
> failover:(nio:localhost1:61616,nio:localhost2:61616)?randomize=true. I
> specify randomize=true to balance the load between the brokers.
> 
> Please suggest what client URI should I use? Should I include all brokers
> URI or just masters URI? Can I still use nio protocol? I prefer to use
> randomize=true so that load will be balanced.

Since you have MasterA and SlaveB running on one machine, it could happen that masterB on
the other machine crashes and SlaveB starts up. You will then need to ensure that SlaveB uses
a different port than MasterA, since both would become active on the same machine. The same
applies to the other box running MasterB and SlaveA.

Your client side broker url will therefore need to include all 4 broker urls. 
So something like
failover:(tcp://machine1:masterAport,tcp://machine2:masterBport,tcp://machine1:slaveBport,tcp://machine2:slaveAport)?randomize=true

You can already make out that this url becomes complex if you add more brokers. 
Sometimes its better to manually partition your clients over the available brokers. I.e. one
set of clients connects to master/SlaveA the other set of clients to master/SlaveB. This is
only suitable for a fixed and static amount of clients. 

Also some background information on network connector configuration for this deployment scenario
in 
http://tmielke.blogspot.de/2011/09/activemq-network-bridge-to-masterslave.html

Hope this helps.

Torsten Mielke
torsten@fusesource.com
tmielke@blogspot.com




Mime
View raw message