I'm working on a distributed failover solution with two AMQ instances I_1 on
hardware node N_1 and I_2 on N_2, both using a common JDBC persistence store
on a DB2 database (I know KahaDB rocks, but my customer feels a lot better
with his DB2 running for decades).

First, I start instance I_1. It obtains an exclusive lock on table
ACTIVEMQ_LOCK and becomes the master. This shows up in the log of I_1:

...
 INFO | Using Persistence Adapter:
JDBCPersistenceAdapter(org.apache.commons.dbcp.basicdatasou...@e11e831)
 INFO | Database adapter driver override recognized for :
[ibm_db2_jdbc_universal_driver_architecture] - adapter: class
org.apache.activemq.store.jdbc.adapter.DB2JDBCAdapter
 INFO | Database lock driver override not found for :
[ibm_db2_jdbc_universal_driver_architecture].  Will use default
implementation.
 INFO | Attempting to acquire the exclusive lock to become the Master broker
 INFO | Becoming the master on dataSource:
org.apache.commons.dbcp.basicdatasou...@e11e831
 INFO | ActiveMQ 5.4.1 JMS Message Broker (localhost) is starting
...

Then I start instance I_2. It hangs and waits for the lock (thus becoming a
slave?):

...
 INFO |
PListStore:C:\dev\bin\apache-activemq-5.4.1-b\bin\..\data\localhost\tmp_storage
started
 INFO | Using Persistence Adapter:
JDBCPersistenceAdapter(org.apache.commons.dbcp.basicdatasou...@275e538e)
 INFO | Database adapter driver override recognized for :
[ibm_db2_jdbc_universal_driver_architecture] - adapter: class
org.apache.activemq.store.jdbc.adapter.DB2JDBCAdapter

Is this the desired behaiviour?  If I shut down I_1, I_2 continues and
finally becomes the new master instance.

If I understand http://activemq.apache.org/jdbc-master-slave.html correctly,
there is only ONE master at all times, even if there are N slaves waiting
idle for the lock?

Is it possible to combine the above failover solution with load balancing,
i.e. having more than one active master, all of them sharing the same JDBC
persistence store?
-- 
View this message in context: 
http://activemq.2283324.n4.nabble.com/JDBC-Master-Slave-Patter-Understanding-Locking-tp2966254p2966254.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to