activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Hilgers <Christian.Hilg...@consol.de>
Subject Re: ActiveMQ Master/slave with MySQLCluster backend
Date Wed, 01 Feb 2012 16:57:04 GMT
Am 31.01.2012 14:13, schrieb Gary Tully:
> This need some work.
> On 5.6, a single broker can deal with a failover of the jdbc store.
> The difficulty is locking in the master/slave case, or peer cluster case.
>
> The current lock impl (who's job it is to get an exclusive lock on the
> store) treats failure of a lock as a fatal event and stops the broker.
>
> What would be great if you could describe how you think it should
> work, or how you would like it to work.
>
> I think this is something we can/should support.

I agree, this should be supported as this is the only way to build continental
clusters.


The current implementation does single
Locking Query is SELECT * FROM ACTIVEMQ_LOCK FOR UPDATE
to determine who is Master.

As this lock is restricted to one specific node, I now understand why AMQ
does the restart.


My suggestion to get out here is:
selected Master does perodically (eg. each second)
SELECT * FROM ACTIVEMQ_LOCK FOR UPDATE
UPDATE UPDATE ACTIVEMQ_LOCK SET TIME=$NOW,BROKER_NAME=$NAME WHERE ID = 1
COMMIT

analog to the idea from
http://mail-archives.apache.org/mod_mbox/activemq-users/201012.mbox/%3CC1CF8737-DD57-49F2-BA6C-3A859EEB6ED3@osterman.com%3E

Slaves do read the timestamp and check it it changes/increases. As long as
it increased, do nothing.
If it does not change for a configured number of reads, try a
SELECT * FROM ACTIVEMQ_LOCK FOR UPDATE
UPDATE UPDATE ACTIVEMQ_LOCK SET TIME=$NOW,BROKER_NAME=$NAME WHERE ID = 1
COMMIT
if it work become new master.

This should allow AMQ to failover the DB connection as the LOCK is only done
during the short update and not the whole time.

The only other Option coming to my mind, would be using an Arbitrator host
as MySQL cluster or Sun Cluster (Quorum Server does). But that might
be more work to implement and does need a third hosts, OK we do need that
third host for MySQL Cluster as Management and Arbiration Host anyhow.

Looking forward to the discussion


Christian
--
Christian Hilgers                  |ConSol*
Tel.   +49.2102.994-483            |Consulting&Solutions Software GmbH
Fax    +49.2102.994-411            |Berliner Str. 101, 40880 Ratingen
email: Christian.Hilgers@consol.de |WWW: http://www.consol.de

Mime
View raw message