摘要: 簡單的部署管理RocketMQ隊列 (nameserver broker在同一機器上)css
RocketMQ 是alibaba開源的消息隊列。java
本文使用的是開源版本v3.18python
系統: centos6.x最小化安裝linux
須要用到的軟件包: nginx
jdk-7u67-linux-x64.tar.gzshell
alibaba-rocketmq-3.1.8.tar.gzcentos
開始安裝bash
#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
配置環境變量tcp
在/etc/profile最後添加gradle
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 安裝完畢。