activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joesan <codeintheo...@gmail.com>
Subject ActiveMQ Clustering Issue
Date Mon, 20 Aug 2012 16:46:07 GMT
Guys,

I have an AMQ cluster setup with 2 brokers that use a shared file system as
its KahaDB storage. Everything works as expected. The Master broker acquires
the lock on the file system and the slave polls every 10 seconds to check if
there is a lock available. So far so good. But then what happens is that, I
start my Consumer and Producer clients which are aware of this cluster. Now,
I send every 10 seconds a message to the AMQ using my Producer which is
picked up by the Consumer. Good so far!

When I shut down my master, my Consumer goes for a toss with the message as
below and shuts down. Why would it not try to connect to the slave?

18:37:00,831 |  WARN | Transport failed to tcp://localhost:61617 ,
attempting to automatically reconnect due to: java.io.EOFException

I had to restart my consumer. But in the mean time, my Producer continued to
send messages to the Slave. Good one from the Producer. Later I turned my
Master on and restarted my Consumer. Then I shut down my Slave AMQ and this
time both my Producer and Consumer went for a toss with the Producer
especially throwing the following message:

18:37:00,816 |  WARN | Transport failed to tcp://localhost:61617 ,
attempting to automatically reconnect due to: java.io.EOFException
Sending: {price=0.38821707862202004, stock=CSCO, offer=0.388605295700642,
up=true} on destination: topic://STOCKS.CSCO
18:37:30,943 |  INFO | Failover timed out after 20111ms
[WARNING]
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
        at java.lang.Thread.run(Thread.java:619)
Caused by: javax.jms.JMSException: Failover timeout of 20000 ms reached.
        at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:62)
        at
org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1284)
        at
org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1754)
        at
org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:231)
        at
org.apache.activemq.ActiveMQMessageProducerSupport.send(ActiveMQMessageProducerSupport.java:300)
        at
org.apache.activemq.book.ch2.portfolio.Publisher.sendMessage(Publisher.java:73)
        at
org.apache.activemq.book.ch2.portfolio.Publisher.main(Publisher.java:49)
        ... 6 more
Caused by: java.io.IOException: Failover timeout of 20000 ms reached.
        at
org.apache.activemq.transport.failover.FailoverTransport.oneway(FailoverTransport.java:460)
        at
org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:40)
        at
org.apache.activemq.transport.ResponseCorrelator.asyncRequest(ResponseCorrelator.java:81)
        at
org.apache.activemq.transport.ResponseCorrelator.request(ResponseCorrelator.java:86)
        at
org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1262)
        ... 11 more

I can see from the message that the fail-over has timed out. But why did it
take for the Master such a long time to acquire the lock? Is there a way
that I can avoid this timeout? I also do not understand why my Consumer does
not wait even though I said it to wait by providing it a timeout option as
below:

    private static String brokerURL =
"failover:(tcp://localhost:61616,tcp://localhost:61617)?randomize=true&startupMaxReconnectAttempts=1&timeout=20000";

Help much appreciated!



--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-Clustering-Issue-tp4655306.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message