activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spiderman2 <shawn.gan...@bridgewatersystems.com>
Subject Re: Failover Functionality - Master/Slave
Date Fri, 09 Feb 2007 22:04:18 GMT

I've gotten the slave to succesfully wait on the db lock. Then it claims it
when I shut the master down :)

The bad part: I've placed 100 message in the Master's queue before shutdown.
Used Jconsole to verify they're there. When the Slave gets the lock and
becomes broker, Jconsole shows that it has no messages.

Shouldn't these messages have been failedover to the *new* Master?





James.Strachan wrote:
> 
> Yes - so fingers crossed once you've got your classpath sorted it should
> be fine
> 
> On 2/9/07, spiderman2 <shawn.gandhi@bridgewatersystems.com> wrote:
>>
>> You are right! Thanks! I'm fairly sure this is the problem. I had the
>> datasource commented out! AH!
>>
>> Now I am pointing the #oracle-ds as in the example. My only next issue is
>> adding the 'oracle.jdbc.driver.OracleDriver' to my classpath. I didn't
>> realize this wasn't included in the distrubution and currently get a
>> classNotFound exeception on start up.
>>
>> Behaviour Follow-up Question: Once I get the JDBC Master-Slave scenario
>> running, if I put 10 messages on the Master and then shut it down, should
>> I
>> expect to see (via JConsole) that the slave new Master's
>> TotalMessageCount
>> be populated with 10 messages?
>>
>> (I didn't post my config because I think you've solved that James)
>>
>>
>> James.Strachan wrote:
>> >
>> > That looks like the problem then :)
>> >
>> > If you post the complete XML config you're using we can point out the
>> > mistake. You basically need to refer to the #oracle-ds in your
>> > <jdbcPersistenceAdapter> like the example does...
>> >
>> >         <jdbcPersistenceAdapter dataSource="#oracle-ds"/>
>> >
>> >
>> > On 2/9/07, spiderman2 <shawn.gandhi@bridgewatersystems.com> wrote:
>> >>
>> >> I've now tried running the Master and Slave on different hosts, as the
>> >> JDBC
>> >> Master-Slave example intends. I see the same thing.
>> >>
>> >> James, it seems you are right in that they don't seem to be using the
>> >> same
>> >> DB. They are both configured to use:
>> >>
>> >> <bean id="oracle-ds" class="org.apache.commons.dbcp.BasicDataSource"
>> >> destroy-method="close">
>> >>     <property name="driverClassName"
>> >> value="oracle.jdbc.driver.OracleDriver"/>
>> >>     <property name="url" value="jdbc:oracle:thin:@ks063:1521:AMQDB"/>
>> >>     <property name="username" value="activemq"/>
>> >>     <property name="password" value="activemq"/>
>> >>     <property name="poolPreparedStatements" value="true"/>
>> >> </bean>
>> >>
>> >> HOWEVER, from the logs I'll show below, they also seem to be using the
>> >> derby
>> >> datasource, and each a different one at that. Showing that both
>> brokers
>> >> are
>> >> becoming masters.
>> >>
>> >> Should I be disabling the JDBCPersistenceAdapter? Or how do I get it
>> to
>> >> share the oracle Database?
>> >>
>> >> EDITED LOGS
>> >> ==========
>> >>
>> >> I start the first broker, Shawn1:
>> >> <snip>
>> >> JDBCPersistenceAdapter  - Database driver
>> >> recognized:[apache_derby_embedded_jdbc_driver]
>> >> DefaultDatabaseLocker    - Attempting to acquire the exclusive lock to
>> >> become the Master broker
>> >> DefaultDatabaseLocker    - Becoming the master on dataSource:
>> >> org.apache.derby.jdbc.EmbeddedDataSource@771eb1
>> >> </snip>
>> >>
>> >> Start up is successul. Now Starting the 2nd Broker, Shawn2:
>> >>
>> >> JDBCPersistenceAdapter  - Database driver
>> >> recognized:apache_derby_embedded_jdbc_driver]
>> >> DefaultDatabaseLocker    - Attempting to acquire the exclusive lock to
>> >> become the Master broker
>> >> DefaultDatabaseLocker    - Becoming the master on dataSource:
>> >> org.apache.derby.jdbc.EmbeddedDataSource@1115152
>> >>
>> >> Network connection between vm://Shawn2#0 and
>> >> tcp://SGANDHI/192.168.150.118:61616(Shawn1) has been established.
>> >>
>> >>
>> >>
>> >>
>> >> James.Strachan wrote:
>> >> >
>> >> > Note that with JDBC Master/Slave you don't network them together -
>> >> > with JDBC Master/Slave there is no direct master-slave
>> communication.
>> >> > Nor should they be aware of each other, as the slave does not start
>> >> > listening on any sockets until it becomes the master (for JDBC
>> >> > master/slave).
>> >> >
>> >> > Could you show your logs? Particular; when running the master, it
>> >> > should be clear it gets the lock on the database, then the slave
>> >> > clearly waits for the lock? Then when the master is killed it should
>> >> > be clear that the slave takes over right?
>> >> >
>> >> > Both brokers are definitely using the same database right? I'm
>> >> > wondering if for some reason the exclusive locking isn't working
>> >> >
>> >> > On 2/8/07, spiderman2 <shawn.gandhi@bridgewatersystems.com> wrote:
>> >> >>
>> >> >> I'm running the JDBC Master/Slave example as defined on
>> >> >> http://activemq.apache.org/jdbc-master-slave.html Web Docs
>> >> >>
>> >> >> Once they're both running (and logs show they're aware of each
>> other),
>> >> I
>> >> >> put
>> >> >> 100 messages on the Master's Queue. When I shut the Master down,
I
>> >> would
>> >> >> expect to see these messages appear on the Slave's queue. But I
>> don't.
>> >> >>
>> >> >> I'm using Jconsole to see the Total Message count.
>> >> >>
>> >> >> MY CONFIG:
>> >> >> ========
>> >> >>
>> >> >> I'm running both Brokers on the same machine - so I had to change
>> the
>> >> >> following on the slave's config to avoid conflict with the Master:
>> >> >>
>> >> >> TransportConnector default: port to 61617 (Instead of 61616)
>> >> >> TransportConnector stompt: port to 61614 (Instead of 61613)
>> >> >> persistenceAdapter:
>> >> >>         jdbcPersistenceAdapter
>> >> >> dataDirectory="${activemq.base}/activemq-data2" instead of data
>> >> >>
>> >> >>
>> >> >> Lastly, I'm using autodiscover:
>> >> >> <networkConnector name="default-nc" uri="multicast://default"/>
>> >> >>
>> >> >> and
>> >> >>
>> >> >>   <bean id="oracle-ds"
>> class="org.apache.commons.dbcp.BasicDataSource"
>> >> >> destroy-method="close">
>> >> >>     <property name="driverClassName"
>> >> >> value="oracle.jdbc.driver.OracleDriver"/>
>> >> >>     <property name="url"
>> value="jdbc:oracle:thin:@ks063:1521:AMQDB"/>
>> >> >>     <property name="username" value="activemq"/>
>> >> >>     <property name="password" value="activemq"/>
>> >> >>     <property name="poolPreparedStatements" value="true"/>
>> >> >>   </bean>
>> >> >>
>> >> >> What am I doing wrong? Or is this correct functionality?
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/Failover-Functionality---Master-Slave-tf3196126s2354.html#a8874536
>> >> >> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > --
>> >> >
>> >> > James
>> >> > -------
>> >> > http://radio.weblogs.com/0112098/
>> >> >
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/Failover-Functionality---Master-Slave-tf3196126s2354.html#a8888358
>> >> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > --
>> >
>> > James
>> > -------
>> > http://radio.weblogs.com/0112098/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Failover-Functionality---Master-Slave-tf3196126s2354.html#a8892110
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> 
> James
> -------
> http://radio.weblogs.com/0112098/
> 
> 

-- 
View this message in context: http://www.nabble.com/Failover-Functionality---Master-Slave-tf3196126s2354.html#a8894414
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message