组建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