标签:activemq集群
activeMQ集群的安装
1.解压
tar zxvf apache-activemq-5.13.3-bin.tar.gz
2.移动解压目录分别生成不同的节点
cp -r apache-activemq-5.13.3 /usr/local/ActiveMQ-node1
cp -r apache-activemq-5.13.3 /usr/local/ActiveMQ-node2
cp -r apache-activemq-5.13.3 /usr/local/ActiveMQ-node3
3,修改每一个节点的注册方式为zookeeper (注意是每一个节点)
vim /usr/local/ActiveMQ-node1/conf/activemq.xml
注释一下信息:
<!--
#81 <persistenceAdapter>
#82 <kahaDB directory="${activemq.data}/kahadb"/>
#83 </persistenceAdapter>
-->
添加如下内容:
<persistenceAdapter>
<replicatedLevelDB
directory="${activemq.data}/leveldb"
replicas="3"
bind="tcp://0.0.0.0:0"
zkAddress="192.168.31.66:2181,192.168.31.66:2182,192.168.31.66:2183"
hostname="192.168.31.66"
sync="local_disk"
zkPath="/activemq/leveldb-stores"/>
</persistenceAdapter>
================================================================================================
说明:
<persistenceAdapter>
<replicatedLevelDB
directory="${activemq.data}/leveldb"
replicas="3" 节点数
bind="tcp://0.0.0.0:0" 对外所有ip提供服务
zkAddress="192.168.31.66:2181,192.168.31.66:2182,192.168.31.66:2183" 向zookeeper上注册的ip和监听的端口
hostname="192.168.31.66" 本机的ip
sync="local_disk" 存储数据为本地硬盘
zkPath="/activemq/leveldb-stores"/>
</persistenceAdapter>
================================================================================================
4.修改每一个节点的监听端口
修改每一个实例的监听端口,修改openwire的值,一个实例端口分别为61616,61617,61618
vim /usr/local/ActiveMQ-node1/conf/activemq.xml
<transportConnectors>
<!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
<transportConnector name="openwire" uri="tcp://0.0.0.0:61617?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
</transportConnectors>
5.如果在一台物理机上做三个节点,必须修改节点的默认管理端口,否侧端口占用
vim /usr/local/ActiveMQ-node1/conf/jetty.xml
#115 <property name="port" value="8162"/> 默认为8161
6.分别启动,关闭三个节点,查看三个节点的状态
/usr/local/ActiveMQ-node1/bin/activemq start/status/stop
7.将集群节点添加为系统服务并设为开机自启
节点一
vim /etc/init.d/activemq-node1
#!/bin/sh
# activemq
# chkconfig: 345 63 37
# description: activemq-node1
. /etc/rc.d/init.d/functions
. /etc/sysconfig/network
case $1 in
start)
sh /usr/local/activeMQ-node1/bin/activemq start
;;
stop)
sh /usr/local/activeMQ-node1/bin/activemq stop
;;
status)
sh /usr/local/activeMQ-node1/bin/activemq status
;;
restart)
sh /usr/local/activeMQ-node1/bin/activemq stop
sh /usr/local/activeMQ-node1/bin/activemq start
;;
esac
exit 0
添加执行权限
chmod +x /etc/init.d/activemq-node1
添加系统服务,设为开机自启
chkconfig --add activemq-node1
chkconfig activemq-node1 on
节点二,节点三类似如上,注意节点目录
本文出自 “92868888” 博客,请务必保留此出处http://92868888.blog.51cto.com/12381417/1907661
标签:activemq集群
原文地址:http://92868888.blog.51cto.com/12381417/1907661