Centos7 RocketMQ单机部署
1 需要用到的软件包和文档
目前在Github上可下载最新的安装包alibaba-rocketmq-3.2.6.tar
下载地址:https://github.com/alibaba/RocketMQ
2.服务器java环境
$java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
3.安装
解压alibaba-rocketmq-3.2.6.tar
tar xvf alibaba-rocketmq-3.1.8.tar.gz -C /opt/calisapp/
配置rocketmq的环境变量,在/etc/profile最后添加
export ROCKETMQ_HOME=/opt/calisapp/alibaba-rocketmq
export PATH=$JAVA_HOME/bin:$ROCKETMQ_HOME/bin:$PATH
使rocketmq的环境变量生效
source /etc/profile
给下列命令可执行权限
cd /opt/calisapp/alibaba-rocketmq/bin/;
chmod +x mqadmin mqbroker mqfiltersrv mqshutdown mqnamesrv
新建日志文件夹
cd /opt/calisapp/alibaba-rocketmq
mkdir log
启动nameserver
nohup mqnamesrv 1>/opt/calisapp/alibaba-rocketmq/log/ng.log 2>/opt/calisapp/alibaba-rocketmq/log/ng-err.log &
查看启动状态
验证nameserver是否启动
$tail -f /opt/calisapp/alibaba-rocketmq/log/ng.log
The Name Server boot success.
启动broker,在启动borker之前需要指定nameserver地址,其中222.20.77.204为所在服务器IP
export NAMESRV_ADDR=222.29.77.204:9876
nohup mqbroker >/opt/calisapp/alibaba-rocketmq/log/mq.log &
验证mqbroker是否启动
tail -f /opt/alibaba-rocketmq/log/mq.log
boot success. and name server is 222.29.77.204:9876
nameserver端口为9876
broker端口为10911
关闭nameserver broker执行的命令
mqshutdown namesrv
mqshutdown broker
关闭nameserver
mqshutdown namesrv
The mqnamesrv(12248) is running...
Send shutdown request to mqnamesrv(12248) OK
关闭broker
$mqshutdown broker
The mqbroker(13634) is running...
Send shutdown request to mqbroker(13634) OK