You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by mk666aim <ma...@aimia.com> on 2019/08/01 11:35:20 UTC

Re: replicated static master/slave - which is the correct URI for an artemis-jms-client?

The below URL does not seem to work for me.
Client basically never switches to the backup node. Isn't that what
reconnectAttempts=-1 will cause?

I used following URL before and the switching happened:

*(tcp://master:61616,tcp://slave:61616)?reconnectAttempts=5*

What am I missing?

And what is the *ha* flag about?


jbertram wrote
> Thanks for following up, Frank. I would expect a URL like this to work:
> 
>   (tcp://master:61616,tcp://slave:61616)?ha=true&reconnectAttempts=-1





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

Re: replicated static master/slave - which is the correct URI for an artemis-jms-client?

Posted by mk666aim <ma...@aimia.com>.
Also, in a scenario where master server is started again, and backup server
should fail back to the master from that moment onwards....
Should the client also reconnect to the master? It does not seem to be
happening, as my client is still locked to the backup server.
When I shut down backup server, client then reconnects to the master, and
then I can start the backup server back.

Is this the expected behaviour?



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

Re: replicated static master/slave - which is the correct URI for an artemis-jms-client?

Posted by mk666aim <ma...@aimia.com>.
Thank you Justin.
I can indeed see in your source code that this flag is being used all over
the place.

I am now using it and also using reconnectAttempts=-1 and things behave ok.

I ran into the issue in one of the client environments where clients did not
want to failover, as if locked in to the same node.
I have found out that the time between the different servers was 1 hour
apart (ntp was not active).
I wonder if this was causing the failover issues, as the problems went away
once all boxes were using the same time (we have got 2 boxes where artemis
brokers run, and 2 boxes where micro-services run).



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

Re: replicated static master/slave - which is the correct URI for an artemis-jms-client?

Posted by Justin Bertram <jb...@apache.org>.
The "ha" parameter tells the client to use the backup information it
receives from the broker so in case the original connection fails it will
automatically connect (i.e. failover) to the backup. Without ha=true on
your client URL you won't get true failover.

I believe what you're seeing is just the client connection failing and then
retrying the initial connectors. However, you haven't provided many
concrete details so it's hard to say.


Justin

On Tue, Aug 13, 2019 at 10:54 AM mk666aim <ma...@aimia.com> wrote:

> So what exactly is the ha parameter for?
> Does it treat servers somehow differently? E.g. *non-ha* pool of servers,
> vs. *ha* pool of servers?
>
> Form what I am seeing, even without it, client fails over to slave after
> retrying master 5 times and then fail over to the slave... So the fail over
> is somehow triggered still...
>
>
>
>
> --
> Sent from:
> http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
>

Re: replicated static master/slave - which is the correct URI for an artemis-jms-client?

Posted by mk666aim <ma...@aimia.com>.
So what exactly is the ha parameter for?
Does it treat servers somehow differently? E.g. *non-ha* pool of servers,
vs. *ha* pool of servers?

Form what I am seeing, even without it, client fails over to slave after
retrying master 5 times and then fail over to the slave... So the fail over
is somehow triggered still...




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

Re: replicated static master/slave - which is the correct URI for an artemis-jms-client?

Posted by Justin Bertram <jb...@apache.org>.
I'd say you're missing the ha flag. To enable failover you need to use
"ha=true" in your URL. Otherwise the client won't know that it's connection
to an HA (i.e. highly available) master/slave pair.


Justin

On Thu, Aug 1, 2019 at 6:35 AM mk666aim <ma...@aimia.com> wrote:

> The below URL does not seem to work for me.
> Client basically never switches to the backup node. Isn't that what
> reconnectAttempts=-1 will cause?
>
> I used following URL before and the switching happened:
>
> *(tcp://master:61616,tcp://slave:61616)?reconnectAttempts=5*
>
> What am I missing?
>
> And what is the *ha* flag about?
>
>
> jbertram wrote
> > Thanks for following up, Frank. I would expect a URL like this to work:
> >
> >   (tcp://master:61616,tcp://slave:61616)?ha=true&reconnectAttempts=-1
>
>
>
>
>
> --
> Sent from:
> http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
>