組建ACTIVEMQ CLUSTER,使得其中一個ACTIVE MQ DOWN掉時,能自動切換到其他節點。
ACTIVEMQ 只有MASTER-SLAVE模式,集群中的多個節點共享消息的存儲,多個節點同時啟動時,競爭消息存儲的鎖,誰先取得,誰就是MASTER,當MASTER DOWN掉時,鎖被釋放,SALVE中馬上又競爭鎖,取得者成為MASTER。
方案:
- 安裝NFSV4
- 修改消息存儲路徑
<persistenceAdapter>
<kahaDB directory="/sharedFileSystem/sharedBrokerData"/>
</persistenceAdapter>
- 客戶端修改連接字符串
failover://(tcp://master:61616,tcp://slave:61616)?randomize=false

--》
https://my.oschina.net/hzchenyh/blog/716424
https://www.iteye.com/blog/shift-alt-ctrl-2069250
https://stackoverflow.com/questions/53542928/activemq-ha-on-failover
https://activemq.apache.org/shared-file-system-master-slaveActiveMQ(6)-基于networkConnector的Broker-Cluster方案
https://blog.csdn.net/jinjin603/article/details/78657387Multi Data Centre Message Brokers with ActiveMQ
https://medium.com/thg-tech-blog/multi-data-centre-message-brokers-with-activemq-28495046370eActiveMQ中的NetworkConnector(網絡連接器)詳解
https://www.iteye.com/blog/manzhizhen-2116920a