您的位置:首页 > 其它

搭建ActiveMQ Master/Slave+Network Cluster集群

2016-07-12 00:00 316 查看
环境信息

三台虚拟机节点(192.168.100.171<debian171>, 192.168.100.172<debian172>, 192.168.100.173<debian173>)

Debian jessie 8.5

ActiveMQ 5.13.3

node1:192.168.100.171:61616,

node2:192.168.100.172:61616,

node3:192.168.100.173:61616,

node4:192.168.100.171:61626,

node2:192.168.100.172:61626,

node4:192.168.100.173:61626

其中

node1,node2,node3为group1(broker_name:broker_cluster_group1)

node4,node5,node6为group2(broker_name:broker_cluster_group2)

搭建Master/Slave集群

参见“搭建ActiveMQ 5.13 Master/Slave (Debian 8)”和“搭建ActiveMQ Master/Slave(LevelDB+Zookeeper)”

配置networkConnector

group1的activemq.xml

<broker xmlns="http://activemq.apache.org/schema/core" brokerName="broker_cluster_group1" dataDirectory="${activemq.data}">
<networkConnectors>
<networkConnector uri="static:(tcp://debian171:61626,tcp://debian172:61626,tcp://debian173:61626)" duplex="false" />
</networkConnectors>

<persistenceAdapter>
<replicatedLevelDB directory="${activemq.data}/leveldb"
replicas="3"
bind="tcp://0.0.0.0:62620"
zkAddress="debian171:2181,debian172:2181,debian173:2181"
zkPassword=""
zkPath="/activemq/leveldb-stores-g1"
hostname="192.168.100.171"/>
</persistenceAdapter>

group2的activemq.xml

<broker xmlns="http://activemq.apache.org/schema/core" brokerName="broker_cluster_group2" dataDirectory="${activemq.data}">
<networkConnectors>
<networkConnector uri="static:(tcp://debian171:61616,tcp://debian172:61616,tcp://debian173:61616)" duplex="false" />
</networkConnectors>

<persistenceAdapter>
<replicatedLevelDB directory="${activemq.data}/leveldb"
replicas="3"
bind="tcp://0.0.0.0:0"
zkAddress="debian171:2181,debian172:2181,debian173:2181"
zkPassword=""
zkPath="/activemq/leveldb-stores-g2
3ff0
"
hostname="debian171"/>
</persistenceAdapter>

修改transportConnectors的端口

<transportConnectors>
<!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
<transportConnector name="openwire" uri="tcp://0.0.0.0:61626?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="amqp" uri="amqp://0.0.0.0:5682?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="stomp" uri="stomp://0.0.0.0:61623?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="mqtt" uri="mqtt://0.0.0.0:1893?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="ws" uri="ws://0.0.0.0:61624?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
</transportConnectors>

修改jetty.xml的console端口

<bean id="jettyPort" class="org.apache.activemq.web.WebConsolePort" init-method="start">
<!-- the default port number for the web console -->
<property name="host" value="0.0.0.0"/>
<property name="port" value="8171"/>
</bean>

OK,逐个启动node1-6,done!

注意

参考资料
http://blog.csdn.net/lifetragedy/article/details/51869032
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  activemq