You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Abimael <ab...@hotmail.com> on 2012/01/16 20:07:50 UTC
Configuration Shared Master Slave (and some questions)
Hi everyone
I'm trying to understand ApacheMQ to achieve a message HA system.
I think that Shared Master Slave is one of the architecture options to me ,
but, unfortunely, I am cannot get the proper configuration .
let me explain the scenario of my tests :
- I want to test HA - that means , if the master goes down, I want slave
became the master and such "slave-master" must continue to broke message as
master was doing;
- I want (or must) be able to get the messages after slave becomes master ;
that means messages must be saved in the slave . The architecture should be
able to save the messages while slave became master;
- the producer and consumer apps should not notice the issue when master
goes down and slave became master.
To achieve such points, I read documentation and tried to understand .. Also
, I checked other sites (for instance
http://note19.com/2007/06/24/activemq-masterslave-setup/
Then ,I set the configuration file , inside broker tag
<networkConnectors>
<networkConnector name="queue"
uri="static://(tcp://sim1648:61616,tcp://sim1660:61616)" />
</networkConnectors>
wheres sim1648 and sim1660 are the computer names for master and slave.
Also, the producer and consumer test applications, I used
failover:(tcp://sim1648:61616,tcp://sim1660:61616)
as a parameter in the code :
ConnectionFactory factory = new
ActiveMQConnectionFactory(failover:(tcp://sim1648:61616,tcp://sim1660:61616)
sim1648 is the master; sim1660 is the slave.
I start Master ActiveMQ , start Slave ActiveMQ ; then start consumer and
producer test apps . I am able to get the message in the consumer sent by
the producer
Then, manually I shutdown Master Broker . In the console of consumer test
app, I got :
75117 [ActiveMQ Transport: tcp://sim1648/127.0.1.1:61616] WARN
org.apache.activemq.transport.failover.FailoverTransport - Transport
(sim1648/127.0.1.1:61616) failed to tcp://sim1648:61616 , attempting to
automatically reconnect due to: java.io.EOFException.
and consumer app finishs.
THe other point is : if I restart consumer, I am able to get the messages
send by producer, BUT, I notice that some of them were lost , I mean,
consumer does not recover or is not able to get the messages sent by
producer while consumer was down .
I guess the issue is a mix of misconfiguration and wrong code in the
consumer , but I am not able to realize what is wrong .
The summary are :
- how can I configure to have proper a HA Master Slave ?
- What should I do to have a consumer able to read (get) messages while it
is down?
Sorry by the big post,
Thanks in advance,
--
View this message in context: http://activemq.2283324.n4.nabble.com/Configuration-Shared-Master-Slave-and-some-questions-tp4301080p4301080.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Configuration Shared Master Slave (and some questions)
Posted by Abimael <ab...@hotmail.com>.
Hi Liny
Well, I am not sure.. I tested with and without ramdomize and consumer
really connects to host sim1648 everytime I run it.
The issue is really when I test and force sim1648 activeMq instance to
down the consumer does not connect to 1660 despite the fact it is the master
(after sim1648 become down) . After the exception message I posted in the
thread , the consumer goes down.
I am able to see that there are messages enqueued via web admin console (as
the producer remains send messages), but only when I restart the consumer,
the messages became "dequeued".
Thank you
--
View this message in context: http://activemq.2283324.n4.nabble.com/Configuration-Shared-Master-Slave-and-some-questions-tp4301080p4303724.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Configuration Shared Master Slave (and some questions)
Posted by liny <in...@gmail.com>.
Hi,
I am new to ActiveMQ and couldn't answer your questions.
But don't you need to add "??randomize=false" to the end of client's
failover URL to force your client always connect master first?
--
View this message in context: http://activemq.2283324.n4.nabble.com/Configuration-Shared-Master-Slave-and-some-questions-tp4301080p4302093.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Configuration Shared Master Slave (and some questions)
Posted by Abimael <ab...@hotmail.com>.
Hello
Well, it is very embarrasing, but , I realized what I was doing wrong :
In the consumer, I created the session BEFORE start the connection .
In Java code :
connectionFactory factory = new ActiveMQConnectionFactory(brokerURL);
connection = factory.createConnection();
connection.setClientID(clientId);
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
// create topic, etc
connection.start();
Then , I realized that it should be :
connectionFactory factory = new ActiveMQConnectionFactory(brokerURL);
connection = factory.createConnection();
connection.setClientID(clientId);
connection.start();
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
// create topic, etc
Now, it works properly .
I hope that my mess can help others.
Thank you very much all
--
View this message in context: http://activemq.2283324.n4.nabble.com/Configuration-Shared-Master-Slave-and-some-questions-tp4301080p4311253.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Configuration Shared Master Slave (and some questions)
Posted by Abimael <ab...@hotmail.com>.
Ops
I realized that I posted a wrong parameter for the configuration files .
The networkConnectors tag is , for both configuration files :
<networkConnectors>
<networkConnector name="HA QUEUE"
uri="static://(tcp://sim1648:61616,tcp://sim1660:61616)" />
</networkConnectors>
I'm using the networkconnectors tag above and I see the error I post in the
"1st thread" I started the topic.
Thanks and sorry by the mess
--
View this message in context: http://activemq.2283324.n4.nabble.com/Configuration-Shared-Master-Slave-and-some-questions-tp4301080p4311095.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Configuration Shared Master Slave (and some questions)
Posted by Abimael <ab...@hotmail.com>.
Hi Zagan
Both, the master and the slave are sharing the same filesystem.
I guess that this is not the issue.
Let me post here some excerpts of the configuration files :
Master.xml :
<broker xmlns="http://activemq.apache.org/schema/core"
brokerName="sim1648"
dataDirectory="/temp/abimael/share/activemqdata"
destroyApplicationContextOnStop="true">
...
<networkConnectors>
<networkConnector name="Fila Master Slave HA - Testes "
uri="static://(tcp://sim1648:61616,tcp://sim1660:61616)" />
</networkConnectors>
...
<persistenceAdapter>
<kahaDB directory="/temp/abimael/share/activemqdata"/>
</persistenceAdapter>
Slave configuration file :
<broker xmlns="http://activemq.apache.org/schema/core"
brokerName="sim1660"
dataDirectory="/temp/abimael/share/activemqdata"
destroyApplicationContextOnStop="true">
...
<networkConnectors>
<networkConnector name="HA QUEUE"
uri="static://(tcp://sim1648:61616,tcp://sim1660:61616)" />
</networkConnectors>
...
<persistenceAdapter>
<kahaDB directory="/simepar/temp/abimael/share/activemqdata"/>
</persistenceAdapter>
Regards
--
View this message in context: http://activemq.2283324.n4.nabble.com/Configuration-Shared-Master-Slave-and-some-questions-tp4301080p4310528.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Configuration Shared Master Slave (and some questions)
Posted by Zagan <er...@gmail.com>.
Hi,
seems to me like you understanding of master/slave configuration is wrong.
To have master/slave sharing the current instance status you have to share
file access between same. They could share the same filesystem or the same
database.
When I tested the failover capabilities with the JMS client, I only had to
specify the failover protocol URL as you did.
Hope this helps
--
View this message in context: http://activemq.2283324.n4.nabble.com/Configuration-Shared-Master-Slave-and-some-questions-tp4301080p4309713.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.