activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From io42 <ingrid.ol...@desknetinc.com>
Subject Shared DB Master/Slave configuration/implementation questions
Date Mon, 12 Mar 2012 20:19:29 GMT
I'm trying configure a JDBC-master-slave setup using a PostgreSQL DB and the
xbean URI scheme, but it is unclear to me how I ought to proceed.  Starting
a single broker is straightforward.  In my Java code I am starting the
broker via the following:

     URI brokerURI = new
URI("xbean:<path_to_attivemq_config_file>\activemq.xml");
     BrokerService broker = BrokerFactory.createBroker(brokerURI);
     broker.start();

Where my broker is configured in the activemq.xml file:
---------------------------------Broker
Config----------------------------------------------------
 <broker xmlns="http://activemq.apache.org/schema/core" useJmx="true"
brokerName="localhost" dataDirectory="${activemq.base}/data">
    <destinationPolicy>
            <policyMap>
              <policyEntries>
                <policyEntry topic=">" producerFlowControl="true"
memoryLimit="1mb">
                  <pendingSubscriberPolicy>
                    <vmCursor />
                  </pendingSubscriberPolicy>
                </policyEntry>
                <policyEntry queue=">" producerFlowControl="true"
memoryLimit="1mb" prioritizedMessages="true">
                </policyEntry>
              </policyEntries>
            </policyMap>
        </destinationPolicy> 
 
	 <persistenceAdapter>
			<jdbcPersistenceAdapter  dataDirectory="${activemq.base}/data" 
dataSource="#postgres-ds" createTablesOnStartup="false" />
	</persistenceAdapter>
		
        <transportConnectors>
            <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
        </transportConnectors>
</broker>
--------------------------------------------------------------------------------------------------

If I want to use the above as my master broker, how do I configure a slave
broker to point to the same DB?  Must I use a separate XML file for each
broker?  If so, how do I use a failover URL to combine the separate xbean
URIs to both of the XML files?

http://activemq.apache.org/jdbc-master-slave.html This page  explains that I
should use the failover transport to connect the available brokers [i.e. use
failover:(tcp://broker1:61616,tcp://broker2:61616], but how do I do that
from my java code? 

Thanks in advance for any input you may have.  My apologies if this has
already been addressed before, but I haven't to been able to find anything
through my search.

Additional bonus questions:  When the master broker has a DB lock, is this a
read lock as well as a write lock?  Does it make any sense for a Slave
broker to be doing anything other than waiting on the master to fail (e.g.
could the slave broker of one DB conceivably be the master of another)?

--
View this message in context: http://activemq.2283324.n4.nabble.com/Shared-DB-Master-Slave-configuration-implementation-questions-tp4467258p4467258.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.

Mime
View raw message