开发者

Active MQ - Network of Brokers

I have configured network of brokers with the topology as below.

  • Producer(P1) connected to Broker(B1) and Producer(P2) connected to Broker(B2)
  • Broker(B1) and Broker(B2) are connected as network of Brokers and are laod balancing
  • Consumer(C1) connected to Broker(B1) and Consumer(C2) connected to Broker(B2)

Clients are configured to use the failover as:

  • Consumer-1 = failover:tcp://localhost:61616,tcp://localhost:61615?randomize=false
  • Consumer-2 = failover:tcp://localhost:61615,tcp://localhost:61616?randomize=false

Once Channel-2 goes down P2 and C2 shifts to Channel-1 which is the desired behaviour for failover.

I want to understand the behavior when Chaneel-2 come back? I have noticed it is only Channel-1 which continues to serve all the connections even after Channel-2 has recovered and thus losing load balancing between Cha开发者_如何转开发nnels.

I want to know if it is possible once Channel-2 is back, load balancing will start automatically between channelsand respective Producer-2, Consumers-2 shifts to Channel-2 and thus giving full load balancing and full failover?

I have came across an article 'Combining Fault Tolerance with Load Balancing' on http://fusesource.com/docs/broker/5.4/clustering/index.html is this recommended for combining Fault Tolerance and Load Balancing?

Regards,

-Amber


On both of your brokers, you need to setup your transportConnector to enable updateClusterClients and rebalanceClusterClients.

 <transportConnectors>
   <transportConnector name="tcp-connector" uri="tcp://192.168.0.23:61616" updateClusterClients="true" rebalanceClusterClients="true" /> 
 </<transportConnectors>

Specifically, you should want rebalanceClusterClients. From the docs at http://activemq.apache.org/failover-transport-reference.html it states that:

if true, connected clients will be asked to rebalance across a cluster of brokers when a new broker joins the network of brokers

You must be using ActiveMQ 5.4 or greater to have these options available.


As an answer to your follow up question: "Is there a way of logging Broker URI as discussed in the article ?"

In order to show what client is connected to what broker, modify the client's Log4j configuration as follow:

<log4j:configuration debug="true"
                     xmlns:log4j="http://jakarta.apache.org/log4j/">

    ...

    <logger name="org.apache.activemq.transport.failover.FailoverTransport">
        <level value="debug"/>
    </logger>

    ...

</log4j:configuration>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜