Using failover with updateClusterClients, which one has precedence?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Using failover with updateClusterClients, which one has precedence?

Devlin
ActiveMQ 5.11

When using failover URLs like this in a network of brokers where
updateClusterClients=true, how is failover handled?

failover:(tcp://hydra:61616,tcp://orion:61616,tcp://omega:61616,tcp://bigmoma:61616)?randomize=false

The behavior we're seeing is that, upon initial connect, the first host
(hydra) is selected, that's expected, but when the connection fails, the
client randomly connects to another broker in the list, not the second host
in the failover URL. So it appears updateClusterClients takes precedence
over the order by which hosts are configured in the failover URL, is that a
valid assumption?





--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
Reply | Threaded
Open this post in threaded view
|

Re: Using failover with updateClusterClients, which one has precedence?

gtully
yes, that is the intent. The broker makes the decision and when it does
round robin or random there should be a reasonable distribution. The issue
when it is left to clients is they can all behave the same - as in non
random random. With updateClusterClients the only random selection lives in
the broker and is shared by the ordered list being pushed to the clients.
There are url parameters to set on failover to have the client ignore that
if you like: reconnectSupported
see http://activemq.apache.org/failover-transport-reference.html

On Wed, 25 Oct 2017 at 16:26 Devlin <[hidden email]> wrote:

> ActiveMQ 5.11
>
> When using failover URLs like this in a network of brokers where
> updateClusterClients=true, how is failover handled?
>
>
> failover:(tcp://hydra:61616,tcp://orion:61616,tcp://omega:61616,tcp://bigmoma:61616)?randomize=false
>
> The behavior we're seeing is that, upon initial connect, the first host
> (hydra) is selected, that's expected, but when the connection fails, the
> client randomly connects to another broker in the list, not the second host
> in the failover URL. So it appears updateClusterClients takes precedence
> over the order by which hosts are configured in the failover URL, is that a
> valid assumption?
>
>
>
>
>
> --
> Sent from:
> http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
>
Reply | Threaded
Open this post in threaded view
|

Re: Using failover with updateClusterClients, which one has precedence?

Devlin
This post was updated on .
The list of active brokers sent to clients via updateClusterClients, how is that list ordered?
Would be helpful if you can point me to the source, I want to add a custom filter to prioritize selection of brokers based on locality.

Ok, I just found updateClusterFilter on the transportCOnnector, this should suffice, but I'm not sure what it's filtering; the broker host name, ID, full connection URL, etc?

Found the source:
https://github.com/apache/activemq/blob/master/activemq-client/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java


--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
Reply | Threaded
Open this post in threaded view
|

Re: Using failover with updateClusterClients, which one has precedence?

gtully
It is sorted by the order in which brokers network to each other. A newly
restarted broker will be appended to that list.
With rebalance, each new connection gets a different first element.

see:
https://git-wip-us.apache.org/repos/asf?p=activemq.git;a=blob;f=activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnector.java;h=ac9661924d5bebbc37fe7f8159acbe2961dd33d9;hb=HEAD#l404

On Thu, 26 Oct 2017 at 14:03 Devlin <[hidden email]> wrote:

> The list of active brokers sent to clients, how is that list ordered?
>
>
>
> --
> Sent from:
> http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
>
Reply | Threaded
Open this post in threaded view
|

Re: Using failover with updateClusterClients, which one has precedence?

Devlin
Ok, that won't help because our network is full graph. From the client's
perspective, is there a way to see the most updated failover connection
list? We're using these methods, but it always shows brokers in what appears
to be alphabetic order.

    BrokerInfo bInfo = connection.getBrokerInfo();
    BrokerInfo[] brokers = bInfo.getPeerBrokerInfos();


Also, regarding updateClientFilter on the transport connector, we want to
filter brokers by region, our broker IDs are simple, eastbroker1,
eastbroker2, and westbroker1, westbroker2, etc. The pattern in the
documentation has this:

updateClusterFilter=".*A.*,.*B.*"

..which I think means any broker id containing 'A', and then any brokers
containing 'B', so for our case, we would tighten that up with the following
to select brokers starting with 'east', then brokers starting with 'west'...

updateClusterFilter="east.*,den.*"

Is that correct?







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