rocketMQ下载URL:https://github.com/alibaba/RocketMQ/releases
规划三台虚拟机,一台NameServer,两台Master,无Slave。
NameServer服务器:192.168.1.222(hostname:db)
Master服务器:192.168.1.219(hostname:app),192.168.1.141(hostname:app2)
请先检查jdk是否安装java -version
rocketMQ默认使用3个端口:9876 、10911、10912。如果防火墙没有关闭的话,那么防火墙就必须开放 9876 端口 、 10911 端口 、 10912 端口
name server 默认使用 9876 端口,master 和 slave 默认使用 10911 端口 、 10912 端口
/sbin/iptables -I INPUT -p tcp --dport 9876 -j ACCEPT
/sbin/iptables -I INPUT -p tcp --dport 10911 -j ACCEPT
/sbin/iptables -I INPUT -p tcp --dport 10912 -j ACCEPT
service iptables save
service iptables restart
注:以下操作需要在所有机子上执行一遍
[root@db logs]# hostname
db
[root@db logs]# vi /etc/hosts
在 /ect/hosts 文件末尾增加 主机名 和 127.0.0.1 的映射
127.0.0.1 db
注:以下操作需要在所有机子上执行一遍
一、下载 rocketmq-3.2.6.tar.gz 并上传到/opt/文件夹中
二、解压 rocketmq-3.2.6.tar.gz ,解压出文件夹rocketmq-3.2.6,并更名为rocketmq ( 最终位置:/opt/rocketmq/ )
三、配置环境变量
在 /etc/profile 文件最后添加:
export ROCKETMQ_HOME=/opt/rocketmq
export PATH=$PATH:$ROCKETMQ_HOME/bin
export NAMESRV_ADDR="192.168.1.222:9876"
添加完成后,执行 source /etc/profile 命令使修改生效
[root@db opt]# source /etc/profile
[root@db opt]# cd rocketmq/bin/
[root@db bin]# chmod +x mqadmin mqbroker mqfiltersrv mqshutdown mqnamesrv
#cd /opt/rocketmq/bin/
#nohup ./mqnamesrv > ./start.log 2>&1 &
#cat start.log
nohup: 忽略输入
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=320m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release.
The Name Server boot success.
#cd /opt/rocketmq/bin/
#nohup ./mqbroker -c ../conf/2m-noslave/broker-a.properties >./start.log 2>&1 &
#cat start.log
nohup: 忽略输入
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=320m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release.
load config properties file OK, ../conf/2m-noslave/broker-a.properties
The broker[broker-a, 192.168.1.219:10911] boot success. and name server is 192.168.1.222:9876
#cd /opt/rocketmq/bin/
#nohup ./mqbroker -c ../conf/2m-noslave/broker-b.properties >./start.log 2>&1 &
#cat start.log
nohup: 忽略输入
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=320m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release.
load config properties file OK, ../conf/2m-noslave/broker-b.properties
The broker[broker-b, 192.168.1.141:10911] boot success. and name server is 192.168.1.222:9876
到此为止,rocketmq已经启动成功了。
下载地址为:rocketmq web console
tomcat安装在NameServer所在的服务器,访问的地址为:http://192.168.1.222:8080/rocketmq-console/cluster/list.do,以下为web控制台界面