Centos安装RocketMQ(3.2.6)

rocketMQ下载URL:https://github.com/alibaba/RocketMQ/releases

1.规划服务器

规划三台虚拟机,一台NameServer,两台Master,无Slave。

NameServer服务器:192.168.1.222(hostname:db)

Master服务器:192.168.1.219(hostname:app),192.168.1.141(hostname:app2)

2.开放rocketmq端口

请先检查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

3. 配置/etc/hosts文件

注:以下操作需要在所有机子上执行一遍

[root@db logs]# hostname
db

[root@db logs]# vi /etc/hosts

在 /ect/hosts 文件末尾增加 主机名 和 127.0.0.1 的映射

127.0.0.1 db

4.安装Rocketmq

注:以下操作需要在所有机子上执行一遍

一、下载 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

5.启动NameServer

#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.

以上信息则显示启动成功。

6.启动Broker


#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已经启动成功了。

7.添加rocketmq web控制台的war包到tomcat底下

下载地址为:rocketmq web console

tomcat安装在NameServer所在的服务器,访问的地址为:http://192.168.1.222:8080/rocketmq-console/cluster/list.do,以下为web控制台界面

Centos安装RocketMQ(3.2.6)_第1张图片


你可能感兴趣的:(Rocketmq)