activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Travis Klotz <>
Subject lease-database-locker allowing multiple brokers to become master
Date Tue, 05 Feb 2013 19:44:39 GMT
Ok,  i'm working with 5.7 and am trying out the lease-database-locker
and am having issues with both of my test instances becoming master.
I assume I must be doing something very obviously wrong but I can't
figure it out.

I'm starting with a base 5.7 windows zip setup run from the command
line (no services).  I add my oracle database driver to the lib/extra
directory.  I modify activemq.xml, change the broker name to "svr1",
modify the persistenceAdapter to look like this:

   <jdbcPersistenceAdapter dataSource="#oracle-ds" lockKeepAlivePeriod="10000">
          <lease-database-locker lockAcquireSleepInterval="5000" />

Remove the jetty include,  change the openwire port number (to avoid
conflicting with my current 5.6 instance) like so:

   <!-- DOS protection, limit concurrent connections to 1000 and frame
size to 100MB -->
   <transportConnector name="openwire"

And then add my database datasource after the broker definition:

<bean id="oracle-cpds"
   <property name="driver" value="oracle.jdbc.driver.OracleDriver"/>
   <property name="url" value="jdbc:oracle:thin:@localhost:1521:xe"/>
   <property name="user" value="activemq"/>
   <property name="password" value="activemq"/>

<bean id="oracle-ds"
   <property name="connectionPoolDataSource" ref="oracle-cpds"/>
   <property name="testOnBorrow" value="true" />
   <property name="testWhileIdle" value="true" />
   <property name="validationQuery" value="select * from dual" />
   <property name="maxActive" value="10" />
   <property name="timeBetweenEvictionRunsMillis" value="300000" />

I then fire up the server and everything seems to be working properly.
 The lock table says "svr1" and the timestap is updated every few

I shutdown the server,  copy the entire install directory to another
location on the same machine and modify the copied activemq.xml file.
I change the broker name to "svr2" and update the port number "41616".
  Next I start up SVR1,  everything goes as expected, database is
updated, JMX reports this instance is not a slave.   Next I start up
SVR2,  it loads says it is attempting to acquire the lease and then
says that it is becoming master, the database is updated with SVR2 and
JMX reports that SVR2 is not the slave.   However nothing seems to
have changed on SVR1,  nothing new in the logs,  JMX still reports
that it is still not the save instance.

About 10% of the time when I start SVR2,  it tries to get the lease
and fails,  waits its 5 seconds and tries again,  succeeds and once
again leaveing SVR1 in some kind of limbo state.

Any ideas what I'm doing wrong?


View raw message