标签:ann HERE ldb bin hat info flow ash replicate
ActiveMQ集群的三种模式,如图(官网)
1、第一种模式基于共享文件系统实现的,例如NFS、GlusterFs
2、第二种模式是共享一个数据库
3、第三种依赖Zookeeper协调分布式服务
如下记载基于第三种方式的安装与配置,基于3台云服务器(m1,m1s1,m1s2)
官网下载压缩包,三台机器分别解压,在zookeeper根目录下创建 data 和 logs 文件夹,把conf目录下的zoo_sample.cfg文件拷贝一份并改名为zoo.cfg(默认配置名),配置如下
# The number of milliseconds of each tick tickTime=2000 # The number of ticks that the initial # synchronization phase can take initLimit=10 # The number of ticks that can pass between # sending a request and getting an acknowledgement syncLimit=5 # the directory where the snapshot is stored. # do not use /tmp for storage, /tmp here is just # example sakes. dataDir=/home/taydawn/zookeeper/data dataLogDir=/home/taydawn/zookeeper/logs # the port at which the clients will connect clientPort=2181 server.1=0.0.0.0:2888:3888 server.2=m1s1:2888:3888 server.3=m1s2:2888:3888 # the maximum number of client connections. # increase this if you need to handle more clients #maxClientCnxns=60 # # Be sure to read the maintenance section of the # administrator guide before turning on autopurge. # # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance # # The number of snapshots to retain in dataDir #autopurge.snapRetainCount=3 # Purge task interval in hours # Set to "0" to disable auto purge feature #autopurge.purgeInterval=1
三台机器配置类似。如果三台机器实在同一局域网下,server配置可以直接用主机名;否则需要把本机的zoo.cfg中的本机的主机名改为 0.0.0.0,否则会出错(例子)。
查看暴露在公网上的Zookeeper的服务器信息
echo envi | nc xx.xx.xx.xx 2181
官网下载压缩包,三台机器分别解压,修改conf目录下的 activemq.conf,修改持久化配置,三台机器的broker名称必须一样
<persistenceAdapter> <!-- <kahaDB directory="${activemq.data}/kahadb"/> --> <replicatedLevelDB directory="${activemq.data}/leveldb" replicas="3" bind="tcp://0.0.0.0:0" zkAddress="m1:2181,m1s1:2181,m1s2:2181" hostname="m1s1" zkPath="/activemq/leveldb-stores" /> </persistenceAdapter>
三台机器配置类似,其中“zkPath”为zookeeper的创建节点名称,可使用 zkCli.sh -server m1:2181 登录zookeeper命令查看(其中bind配置可以指定port,例如0.0.0.0:61619,0.0.0.0:0代表使用动态端口,由ActiveMQ自己指定空闲端口)
依次启动Zookeeper的每一个节点,然后再依次启动ActiveMQ的三个节点即可。
相关文章
1、集群配置参考文章
ActiveMQ高可用集群部署(基于Replicated LevelDB Store + Zookeeper)
标签:ann HERE ldb bin hat info flow ash replicate
原文地址:https://www.cnblogs.com/Vince-blogs/p/10078049.html