ActiveMQ network of brokers: random conectivity wi

2019-08-17 16:47发布

问题:

I have a network of brokers with the following configuration

  <transportConnectors>
        <transportConnector name="tomer-amq-test2" uri="tcp://0.0.0.0:61616" updateClusterClients="true" rebalanceClusterClients="true" updateClusterClientsOnRemove="true"/>
  </transportConnectors>

I expect that when I connect using the URL

failover:\(tcp://tomer-amq-test2:61616\)?backup=true 

the broker shall update th client with the full list of brokers it is conencted too, and the client shall connect to one randomly, and to a second as backup
however this is not happening and the client connects only to the specified broker in the url

help anyone?
Tx Tomer

回答1:

figured out the problem (at least on my env)
when a broker updates another broker that it is up, it identifies itself by the server name.
once the server name of all brokers was added to /etc/hosts on the client side, all was well
:)
I guess this is bad practice, and the broker should identify itself by ip and not by hostname

I was running activeMQ 5.5.1 on ubuntu 10.4



回答2:

Your client will only be updated with the full broker-list if some or the following properties are true: updateClusterClients rebalanceClusterClients and updateClusterClientsOnRemove.

you have to set them manually on your client as they are false by default.

see: http://activemq.apache.org/failover-transport-reference.html