搭建ActiveMQ Master/Slave+Network Cluster集群
博客专区 > norxiva 的博客 > 博客详情
搭建ActiveMQ Master/Slave+Network Cluster集群
norxiva 发表于1年前
搭建ActiveMQ Master/Slave+Network Cluster集群
  • 发表于 1年前
  • 阅读 26
  • 收藏 1
  • 点赞 0
  • 评论 0

腾讯云 技术升级10大核心产品年终让利>>>   

环境信息

三台虚拟机节点(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

标签: activemq
共有 人打赏支持
粉丝 0
博文 11
码字总数 5308
×
norxiva
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: