ActiveMQ 安装

安装ActiveMQ必须要装zookeeper,比较简单点击可前往参考我的上一篇文章!

创建安装目录
mkdir /software/data/activemq-cluster

下载activemq并解压

wget http://archive.apache.org/dist/activemq/5.15.7/apache-activemq-5.15.7-bin.tar.gz
tar xf apache-activemq-5.15.7-bin.tar.gz

重命名为activemq

mv apache-activemq-5.15.7-bin activemq

修改activemq.xml

cd activemq/conf
vim activemq.xml

1、修改brokerName为“clusterA”(三个MQ节点均修改为一致)

<!--
    The <broker> element is used to configure the ActiveMQ broker.
-->
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="clusterA" dataDirectory="${activemq.data}">

2、修改持久化策略

 <persistenceAdapter>
   <!--  <kahaDB directory="${activemq.data}/kahadb"/>   -->
     <replicatedLevelDB 
          directory="${activemq.data}/leveldb"
   replicas="3"    #集群实例数量
   bind="tcp://0.0.0.0:0:62621"      #实例间通信端口
   zkAddress="192.168.1.102:2181,192.168.1.103:2181,192.168.1.105:2181"   #zookeeper地址
   hostname="192.168.1.102"   #本机地址
   sync="local_disk"
   zkPath="/activemq/leveldb-stores"   #zookeeper中存储路径
   />
</persistenceAdapter>

指定ActiveMQ的运行java环境

修改bin目录下的env文件,找到JAVA_HOME,删除注释改为以下

# (set JAVACMD to "auto" for automatic detection)
JAVA_HOME="/software/data/jdk1.8.0_231"
JAVACMD="auto"

启动服务

./activemq start
-------------本文结束感谢您的阅读-------------
请我吃辣条
0%