rocketmq单机搭建
RocketMQ 是alibaba开源的消息队列。
本文使用的是开源版本v3.18
系统: centos6.x最小化安装
需要用到的软件包:
jdk-7u67-linux-x64.tar.gz
alibaba-rocketmq-3.1.8.tar.gz
开始安装
#tar xvf jdk-7u67-linux-x64.tar.gz -C /opt/
#tar xvf alibaba-rocketmq-3.1.8.tar.gz -C /opt/
#ln -s /opt/jdk1.7.0_67 /opt/jdk
配置环境变量
在/etc/profile最后添加
export JAVA_HOME=/opt/jdk
export ROCKETMQ_HOME=/opt/alibaba-rocketmq
export PATH=$JAVA_HOME/bin:$ROCKETMQ_HOME/bin:$PATH
使变量生效
source /etc/profile
验证java
# java -version
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
给下列命令可执行权限
#cd /opt/alibaba-rocketmq/bin/;chmod +x mqadmin mqbroker mqfiltersrv mqshutdown mqnamesrv
启动nameserver
#nohup mqnamesrv >/var/log/ns.log &
验证nameserver是否启动
# tail -f /var/log/ns.log
The Name Server boot success.
启动broker
在启动borker之前需要指定nameserver地址
#export NAMESRV_ADDR=Your_name_IP:9876
#nohup mqbroker >/var/log/mq.log &
验证mqbroker是否启动
# tail -f /var/log/mq.log
The broker[Your_hostname, Your_IP:10911] boot success. and name server is Your_IP:9876
最后配置防火墙
nameserver端口为9876
broker端口为10911
lokkit -p 9876:tcp -p 10911:tcp
关闭nameserver broker
#mqshutdown namesrv
#mqshutdown broker
至此 RockerMQ 安装完毕。