Thanks.  It's running in a Docker container, so I "docker stop" it.  I can
see the log output as the slave takes over and starts up, and then I can log
into the old slave's ActiveMQ management console.  And, I can see that the
client detects the down master and attempts reconnects.

Having said that - I've tried a number of variations on what you pointed out
- i.e. adding query params to the url.  My url looks like this:

(tcp://activemq-1:61616,tcp://activemq-2:61616)?ha=true&reconnectAttempts=60&retryInterval=1000

and, when I kill the master's Docker container, my client side code goes
into the reconnect logic, and iterates the appropriate number of times to
try to reconnect.  However - it only ever attempts to reconnect to the
original connected server.  So - if when I start up my client code
'activemq-1' is the master and 'activemq-2' is the slave, the client
connects to 'activemq-1'.  When I kill 'activemq-1', the client only
attempts reconnecting to 'activemq-1', and doesn't try 'activemq-2'.

This is logged to the console (yeah - I know the message says 10 times, and
my query reconnectAttempts is set to 60 - I still have a hard override in my
code.  I'll clean that up before I'm all done...):

WARN  o.a.activemq.artemis.core.client - AMQ212005: Tried 10 times to
connect. Now giving up on reconnecting it.

I can see both servers listed in the '

I've tried it with 'activemq-1' being the master and 'activemq-2' being the
slave, I've tried it the other way around, and I've tried it with only one
server running, and starting up the other once the client has initialized. 
Same basic problem with each attempt.

During the reconnect attempts, I can see (in the debugger) that
ClientSessionFactyoryImpl's serverLocator has both 'activemq-1' and
'activemq-2' in the 'initialConnectors' array.

This might be a clue.  I don't know what the Topology object should look
like, but the 'topology' hash map is empty.  And, this output when I turned
on 'debug' logging for activemq classes:

2019-07-08 21:18:31,883 UTC [main] DEBUG
o.a.a.a.c.c.i.ClientSessionFactoryImpl - ClientSessionFactoryImpl received
backup update for live/backup pair =
TransportConfiguration(name=null:tcp://activemq-2:61616,
factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory)
?port=61616&host=activemq-2&reconnectAttempts=60&ha=true&retryInterval=1000
/ null but it didn't belong to
TransportConfiguration(name=null:tcp://activemq-2:61616,
factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory)
?port=61616&host=activemq-2&reconnectAttempts=60&ha=true&retryInterval=1000


Further - here's the console log debug output for one iteration of
attempting to reconnect on the client:

2019-07-08 21:31:48,619 UTC [Thread-2 (ActiveMQ-client-global-threads)]
DEBUG o.a.a.a.c.r.i.netty.NettyConnector - Connector NettyConnector
[host=activemq-2, port=61616, httpEnabled=false, httpUpgradeEnabled=false,
useServlet=false, servletPath=/messaging/ActiveMQServlet, sslEnabled=false,
useNio=true] using native epoll
2019-07-08 21:31:48,620 UTC [Thread-2 (ActiveMQ-client-global-threads)]
DEBUG o.a.activemq.artemis.core.client - AMQ211002: Started EPOLL Netty
Connector version 4.1.31.Final to activemq-2:61616
2019-07-08 21:31:48,625 UTC [Thread-2 (ActiveMQ-client-global-threads)]
DEBUG o.a.a.a.c.r.i.netty.NettyConnector - Remote destination:
activemq-2/10.5.85.142:61616
2019-07-08 21:31:49,896 UTC [Thread-2 (ActiveMQ-client-global-threads)]
DEBUG o.a.a.a.c.c.i.ClientSessionFactoryImpl - Connector towards
NettyConnector [host=activemq-2, port=61616, httpEnabled=false,
httpUpgradeEnabled=false, useServlet=false,
servletPath=/messaging/ActiveMQServlet, sslEnabled=false, useNio=true]
failed
2019-07-08 21:31:49,899 UTC [Thread-2 (ActiveMQ-client-global-threads)]
DEBUG o.a.a.a.c.c.i.ClientSessionFactoryImpl - Backup is not active, trying
original connection configuration now.
2019-07-08 21:31:50,901 UTC [Thread-2 (ActiveMQ-client-global-threads)]
DEBUG o.a.a.a.c.c.i.ClientSessionFactoryImpl - Trying reconnection attempt
1/10
2019-07-08 21:31:50,902 UTC [Thread-2 (ActiveMQ-client-global-threads)]
DEBUG o.a.a.a.c.c.i.ClientSessionFactoryImpl - Trying to connect with
connectorFactory =
org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory@31973858,
connectorConfig=TransportConfiguration(name=null:tcp://activemq-2:61616,
factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory)
?port=61616&host=activemq-2&reconnectAttempts=60&ha=true&retryInterval=1000

where I see "Backup is not active, trying original connection configuration
now."

(Sorry - I inherited the ActiveMQ master / backup setup from another
engineer who isn't with the company any more - and I suspect from the above
that it might not be set up correctly?)

Thanks!

Any thoughts?

Thanks!



--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html

Reply via email to