You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by "Michael S." <ms...@ag.com> on 2009/04/09 21:21:31 UTC

HA Active MQ question

All,

I've searched through existing messages, but I've not seen messages that
seem to address my question(s) directly.

I'm trying to design an Active MQ setup with the following properties:

1. HA - I'd like our setup to be available 99.9% of the time.
2. Messages don't get lost - this is probably the most important
requirement.

We'll be running our Active MQ instances on CentOS Linux, optionally backed
by MySQL data stores. We'll be using Active MQ 5.2.

I've looked through the Master/Slave documentation but I find it confusing.
My first thought was to have a master/slave setup with a shared database.
However, how do the clients (Stomp) know how to switch from one server to
the other? Does that logic need to be written into the client? I've seen
references to a failover URI:

failover:(tcp://primary:61616,tcp://secondary:61616)?randomize=false

Is that something that goes in the broker? In the client? I'm finding this
very confusing. If somebody had an example of using that failover URI in
practice, that'd be a huge help.

I guess my main question/concern is client configuration. If I have a
master/slave setup (with the master and slave on two different machines),
how will the clients resolve the proper Active MQ instance to which they're
supposed to connect? How do I do this without losing messages?

Apologies if this has been answered already in the forums.

Thanks.

Michael





-- 
View this message in context: http://www.nabble.com/HA-Active-MQ-question-tp22977610p22977610.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: HA Active MQ question

Posted by Bruce Snyder <br...@gmail.com>.
On Thu, Apr 9, 2009 at 1:21 PM, Michael S. <ms...@ag.com> wrote:
>
> All,
>
> I've searched through existing messages, but I've not seen messages that
> seem to address my question(s) directly.
>
> I'm trying to design an Active MQ setup with the following properties:
>
> 1. HA - I'd like our setup to be available 99.9% of the time.
> 2. Messages don't get lost - this is probably the most important
> requirement.
>
> We'll be running our Active MQ instances on CentOS Linux, optionally backed
> by MySQL data stores. We'll be using Active MQ 5.2.
>
> I've looked through the Master/Slave documentation but I find it confusing.
> My first thought was to have a master/slave setup with a shared database.
> However, how do the clients (Stomp) know how to switch from one server to
> the other? Does that logic need to be written into the client? I've seen
> references to a failover URI:
>
> failover:(tcp://primary:61616,tcp://secondary:61616)?randomize=false
>
> Is that something that goes in the broker? In the client? I'm finding this
> very confusing. If somebody had an example of using that failover URI in
> practice, that'd be a huge help.

The URI noted above is used on the client-side in the same manner as
using a tcp:// URI. Below is a quick example:

String brokerUri =
"failover:(tcp://primary:61616,tcp://secondary:61616)?randomize=false";

ActiveMQConnectionFactory connectionFactory =
        new ActiveMQConnectionFactory(brokerUri);
Connection connection = connectionFactory.createConnection();

The failover:// portion of the URI indicates to the client to use the
failover transport:

http://activemq.apache.org/failover-transport-reference.html

> I guess my main question/concern is client configuration. If I have a
> master/slave setup (with the master and slave on two different machines),
> how will the clients resolve the proper Active MQ instance to which they're
> supposed to connect?

As indicated in the docs, the failover transport tries each URI listed
until it finds one available or it times out.

> How do I do this without losing messages?

This is where a pure master/slave configuration would enter the picture:

http://activemq.apache.org/pure-master-slave.html

Read the section titled, 'How Pure Master Slave works'. This explains
that a master doesn't act on a message until it has been successfully
replicated to a slave.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

ActiveMQ in Action: http://bit.ly/2je6cQ
Blog: http://bruceblog.org/
Twitter: http://twitter.com/brucesnyder