搭建ActiveMQ Master/Slave+Network Cluster集群

环境信息

三台虚拟机节点(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"
        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&amp;wireFormat.maxFrameSize=104857600"/>
	<transportConnector name="amqp" uri="amqp://0.0.0.0:5682?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
	<transportConnector name="stomp" uri="stomp://0.0.0.0:61623?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
	<transportConnector name="mqtt" uri="mqtt://0.0.0.0:1893?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
	<transportConnector name="ws" uri="ws://0.0.0.0:61624?maximumConnections=1000&amp;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

转载于:https://my.oschina.net/norxiva/blog/710466

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值