Hello, in our Company we have the requirement of setting up a high available Cluster of JMS Brokers which would be connected to an ESB in order to maintain async calls.
upon studying the requirements we came up with the following Cluster topology to cover our requirement. In general it is a Master/Slave Topology using a shared File System and a static client discovery. For maintenance and operation issues e.g. OS or HW updates of these the Nodes/Servers the Fail-over should also work properly. *Server side Setup / Topology*: 3 Server Node on which one Master and one Slave are running. The messages are being persisted via the KahaDb which writes in a shared storage. The shared storage is mounted (probabley not recommended) via NFS.V4 and we know the issues about NFS. Each Master writes on its Folder. The Slave writes on the Folder of its Master. No Network connectors or discovery are configured between the servers, so each is running as a stand-alone server. When running/Starting the Cluster we first start the Masters and that their Slaves. Once a Master is started it creates the LOCK of the shared storage and the Slave waits till this lock ist gone, so it can start and create its LOCK. The NFS.V4 Mount is not making any troubles till now, it could be slow but for our initial purpose it is covering our requirements. *Therefore see http://activemq.2283324.n4.nabble.com/file/n3972689/pic1_master_slave_z.jpg * *Client Side / Message Producer*: The Connection factory connects to a composite of 3 Failover networks as a static list of the Server IPs using the TCP protocol and Each netowrk consists of one Master and to slaves where the randomization is disabled. The final composite consists of three such networks where the randomization is enabled. See therefore this image: http://activemq.2283324.n4.nabble.com/file/n3972689/pic2_master_Slave_ClientFailover_config_network1.jpg *The activemq.xml:* <beans xmlns="http://www.springframework.org/schema/beans" xmlns:amq="http://activemq.apache.org/schema/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd"> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <value>file:${activemq.base}/conf/credentials.properties</value> </property> </bean> <broker xmlns="http://activemq.apache.org/schema/core" brokerName="mastera" dataDirectory="${activemq.base}/data/" destroyApplicationContextOnStop="false"> <destinationPolicy> <policyMap> <policyEntries> <policyEntry topic=">" producerFlowControl="true" memoryLimit="1mb"> <pendingSubscriberPolicy> <vmCursor /> </pendingSubscriberPolicy> </policyEntry> <policyEntry queue=">" producerFlowControl="true" memoryLimit="1mb"> </policyEntry> </policyEntries> </policyMap> </destinationPolicy> <persistenceAdapter> <kahaDB directory="/nfsv4/storage1/kahadb"/> </persistenceAdapter> <transportConnectors> <transportConnector name="openwire" uri="tcp://master1:61616"/> </transportConnectors> </broker> <import resource="jetty.xml"/> </beans> *The Producer test code:* String network1 = "tcp://master1:61616,tcp://slave1:61716,tcp:slave3:61716"; String network2 = "tcp://master2:61616,tcp://slave2:61716,tcp://slave3:61716"; String network3 = "tcp://master3:61616,tcp://slave3:61716,tcp://slave2:61716"; ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("failover:(" + "failover:(" + network1 + "," + network2 + "," + network3 + ")?randomize=false," + "failover:(" + network2 + "," + network3 + "," + network1 + ")?randomize=false," + "failover:(" + network3 + "," + network1 + "," + network2+ ")?randomize=false" + ")?randomize=true"); Connection connection; try { connection = connectionFactory.createConnection(); connection.start(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Destination destination = session.createQueue(subject); MessageProducer producer = session.createProducer(destination); for (int i = 0; i < 300000; i++) { TextMessage message = session.createTextMessage("Hello msg " + i); producer.send(message); } session.close(); connection.close(); } catch (JMSException e) { e.printStackTrace(); } *Why the conncetionFactory looks like this:* ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("failover:(" + "failover:(" + network1 + "," + network2 + "," + network3 + ")?randomize=false," + "failover:(" + network2 + "," + network3 + "," + network1 + ")?randomize=false," + "failover:(" + network3 + "," + network1 + "," + network2+ ")?randomize=false" + ")?randomize=true"); + whithin each Failover config (e.g. network1 + network2 + network3) the randomization is turned off to always begin with this order to achieve the real Failover scenario. + Over these Failovers the randomization is enabled in order to achieve the client side load balancing. * The questions we have:* + is this ok? correct? + do you have better options for Load balancing? Thanks in Advance Nizar Kais -- View this message in context: http://activemq.2283324.n4.nabble.com/understanding-the-Load-balancing-of-the-Master-Slave-shared-store-topology-tp3972689p3972689.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.