ActiveMQ单机安装
下载链接
:https://activemq.apache.org/components/classic/download/
安装jdk8
- 查询yum库中java版本
[root@localhost ~]# yum list java*
已加载插件:fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Determining fastest mirrors
可安装的软件包
java-1.6.0-openjdk.x86_64 1:1.6.0.41-1.13.13.1.el7_3 local
java-1.6.0-openjdk-devel.x86_64 1:1.6.0.41-1.13.13.1.el7_3 local
java-1.7.0-openjdk.x86_64 1:1.7.0.141-2.6.10.5.el7 local
java-1.7.0-openjdk-devel.x86_64 1:1.7.0.141-2.6.10.5.el7 local
java-1.7.0-openjdk-headless.x86_64 1:1.7.0.141-2.6.10.5.el7 local
java-1.8.0-openjdk.x86_64 1:1.8.0.131-11.b12.el7 local
java-1.8.0-openjdk-devel.x86_64 1:1.8.0.131-11.b12.el7 local
java-1.8.0-openjdk-headless.x86_64 1:1.8.0.131-11.b12.el7 local
java-atk-wrapper.x86_64 0.30.4-5.el7 local
javamail.noarch 1.4.6-8.el7 local
javapackages-tools.noarch 3.4.1-11.el7 local
javassist.noarch 3.16.1-10.el7 local
- 需要安装
java-1.8.0-openjdk.x86_64
和java-1.8.0-openjdk-devel.x86_64
[root@localhost ~]# yum -y install java-1.8.0-openjdk.x86_64 java-1.8.0-openjdk-devel.x86_64
- 查看java版本
[root@localhost ~]# java -version
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-b12)
OpenJDK 64-Bit Server VM (build 25.131-b12, mixed mode)
安装ActiveMQ
- 创建解压路径及解压缩
[root@localhost ~]# ll
总用量 62716
-rw-------. 1 root root 1262 1月 23 2019 anaconda-ks.cfg
-rw-r--r-- 1 root root 64213100 9月 29 11:38 apache-activemq-5.16.5-bin.tar.gz
[root@localhost ~]# mkdir /data
[root@localhost ~]# tar -zxvf apache-activemq-5.16.5-bin.tar.gz -C /data/
- 编辑
/data/apache-activemq-5.16.5/conf/jetty.xml
[root@localhost ~]# vi /data/apache-activemq-5.16.5/conf/jetty.xml
119 <property name="host" value="127.0.0.1"/>
# 将127.0.0.1替换为0.0.0.0
119 <property name="host" value="0.0.0.0"/>
启动ActiveMQ
[root@localhost ~]# /data/apache-activemq-5.16.5/bin/linux-x86-64/activemq start
验证
- 网页登录
IP:8161
- 默认密码:admin/admin
Active集群安装
基本环境
节点 | IP | openwire | admin端口 |
---|---|---|---|
broker1 | 192.168.100.105 | 61616 | 8161 |
broker2 | 192.168.100.106 | 61616 | 8161 |
broker3 | 192.168.100.107 | 61616 | 8161 |
安装ActiveMQ
- 配置hosts,三台配置一致
[root@broker1 ~]# cat <<EOF >>/etc/hosts
192.168.100.105 broker1
192.168.100.106 broker2
192.168.100.107 broker3
EOF
- 安装
java-1.8.0-openjdk.x86_64
和java-1.8.0-openjdk-devel.x86_64
,三台配置一致
[root@broker1 ~]# yum -y install java-1.8.0-openjdk.x86_64 java-1.8.0-openjdk-devel.x86_64
- 创建解压路径及解压缩,三台配置一致
[root@broker1 ~]# ll
总用量 62716
-rw-------. 1 root root 1262 1月 23 2019 anaconda-ks.cfg
-rw-r--r-- 1 root root 64213100 9月 29 11:38 apache-activemq-5.16.5-bin.tar.gz
[root@localhost ~]# mkdir /data
[root@localhost ~]# tar -zxvf apache-activemq-5.16.5-bin.tar.gz -C /data/
修改配置
- 编辑
activemq.xml
[root@broker1 ~]# vi /data/apache-activemq-5.16.5/conf/activemq.xml
40 <broker xmlns="http://activemq.apache.org/schema/core" brokerName="broker1" dataDirectory="${activemq.data}">
[root@broker2 ~]# vi /data/apache-activemq-5.16.5/conf/activemq.xml
40 <broker xmlns="http://activemq.apache.org/schema/core" brokerName="broker2" dataDirectory="${activemq.data}">
[root@broker3 ~]# vi /data/apache-activemq-5.16.5/conf/activemq.xml
40 <broker xmlns="http://activemq.apache.org/schema/core" brokerName="broker3" dataDirectory="${activemq.data}">
- 添加配置
broker2
与broker3
[root@broker2 ~]# vi /data/apache-activemq-5.16.5/conf/activemq.xml
在<transportConnectors>标签前添加如下内容:注意,此处的IP为节点1的服务器IP
111 <networkConnectors>
112 <networkConnector uri="static:(tcp://192.168.100.105:61616)" duplex="true"/>
113 </networkConnectors>
[root@broker3 ~]# vi /data/apache-activemq-5.16.5/conf/activemq.xml
在<transportConnectors>标签前添加如下内容:注意,此处的IP为节点1的服务器IP
<networkConnectors>
<networkConnector uri="static:(tcp://192.168.100.105:61616,tcp://192.168.100.105:61616)" duplex="true"/>
</networkConnectors>
- 修改jetty.xml,将host改为本机IP
[root@broker1 ~]# vi /data/apache-activemq-5.16.5/conf/jetty.xml
119 <property name="host" value="192.168.100.105"/>
[root@broker2 ~]# vi /data/apache-activemq-5.16.5/conf/jetty.xml
119 <property name="host" value="192.168.100.106"/>
[root@broker3 ~]# vi /data/apache-activemq-5.16.5/conf/jetty.xml
119 <property name="host" value="192.168.100.107"/>
启动验证
[root@broker1 ~]# /data/apache-activemq-5.16.5/bin/linux-x86-64/activemq start
[root@broker2 ~]# /data/apache-activemq-5.16.5/bin/linux-x86-64/activemq start
[root@broker3 ~]# /data/apache-activemq-5.16.5/bin/linux-x86-64/activemq start
标签:ActiveMQ,java,x86,安装,64,apache,root,activemq
From: https://www.cnblogs.com/lzexin/p/17844955.html