如何避免只连接到 ActiveMQ 中的一个代理?
how to avoid connecting to just one broker in ActiveMQ?
我们已经部署了一个使用 P2P 的代理集群 model.Data 分布在整个 cluster.Our 许多消费者使用相同的地址 "failover:(tcp://ip1:61616,tcp://ip2:61616,tcp://ip3:61616,tcp://ip4:61616,tcp:/ip5:61616)?nested.wireFormat.maxInactivityDuration=1000"
.但是最后我们发现,很多消费者会连接同一个broker,这使得不在broker上的数据从其他brokers.This传输过来占用带宽很多。
我如何解决平衡问题?消费者如何决定使用哪个经纪人?
例如,我们有 3 个代理,所有代理都配置了以下代码段:
<transportConnectors>
<transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximum
Connections=1000&wireFormat.maxFrameSize=104857600" updateClusterClients="true" rebalanceClusterClients="true" updateClusterClientsOnRemove="true" discoveryUri="multicast://default" />
</transportConnectors>
<networkConnectors>
<networkConnector uri="multicast://default"/>
</networkConnectors>
在消费者程序中,我使用"failover:(tcp://broker1:61616,tcp://broker2:61616)?nested.wireFormat.maxInactivityDuration=1000"作为代理地址。
我运行三个consumer进程,发现三个进程最终都连接到broker1IP导致broker2和broker3中的数据被传输到broker1消费。
这会导致巨大的网络负担。
我假设您正在为代理中的消息寻找负载平衡,您可以使用代理网络来解决该问题,查看此 link 了解更多信息 http://activemq.apache.org/networks-of-brokers.html
我们已经部署了一个使用 P2P 的代理集群 model.Data 分布在整个 cluster.Our 许多消费者使用相同的地址 "failover:(tcp://ip1:61616,tcp://ip2:61616,tcp://ip3:61616,tcp://ip4:61616,tcp:/ip5:61616)?nested.wireFormat.maxInactivityDuration=1000" .但是最后我们发现,很多消费者会连接同一个broker,这使得不在broker上的数据从其他brokers.This传输过来占用带宽很多。 我如何解决平衡问题?消费者如何决定使用哪个经纪人?
例如,我们有 3 个代理,所有代理都配置了以下代码段:
<transportConnectors>
<transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximum
Connections=1000&wireFormat.maxFrameSize=104857600" updateClusterClients="true" rebalanceClusterClients="true" updateClusterClientsOnRemove="true" discoveryUri="multicast://default" />
</transportConnectors>
<networkConnectors>
<networkConnector uri="multicast://default"/>
</networkConnectors>
在消费者程序中,我使用"failover:(tcp://broker1:61616,tcp://broker2:61616)?nested.wireFormat.maxInactivityDuration=1000"作为代理地址。 我运行三个consumer进程,发现三个进程最终都连接到broker1IP导致broker2和broker3中的数据被传输到broker1消费。 这会导致巨大的网络负担。
我假设您正在为代理中的消息寻找负载平衡,您可以使用代理网络来解决该问题,查看此 link 了解更多信息 http://activemq.apache.org/networks-of-brokers.html