标签:
环境准备:CentOS_6.5_x64
IP: 192.168.0.249 dbTest249 Master1
IP: 192.168.0.251 webTest251 Master2
下载 alibaba-rocketmq 软件
https://github.com/alibaba/RocketMQ/releases
=================================================================================================================================================
一、安装rocketmq
# tar zxf alibaba-rocketmq-3.2.4-beta1.tar.gz -C /usr/local/
# cd /usr/local/
# ln -s /usr/local/alibaba-rocketmq /usr/local/rocketmq
# cd rocketmq/
二、配置主从
1、分别在249、251上编辑配置文件
# hostname
# vim conf/2m-noslave/broker-a.properties
1 #####################Master1服务器配置文件#####################
2 brokerClusterName=FusionCluster
3 brokerName=broker-a
4 brokerId=0
5 namesrvAddr=dbTest249:9876;webTest251:9876
6 deleteWhen=04
7 fileReservedTime=120
8
9 brokerRole=ASYNC_MASTER
10 flushDiskType=ASYNC_FLUSH
11 sstorePathRootDir=/data/rocketmq/store
12 storePathCommitLog=/data/rocketmq/store/commitlog
1 #####################Master2服务器配置文件#####################
2 brokerClusterName=FusionCluster
3 brokerName=broker-b
4 brokerId=1
5 namesrvAddr=dbTest249:9876;webTest251:9876
6 deleteWhen=04
7 fileReservedTime=120
8
9 brokerRole=ASYNC_MASTER
10 flushDiskType=ASYNC_FLUSH
11 listenPort=10911
12 sstorePathRootDir=/data/rocketmq/store
13 storePathCommitLog=/data/rocketmq/store/commitlog
2、编辑JAVA内存块
# vim bin/runbroker.sh
如果服务器内存不够,可以修改runserver.sh脚本(mqnamesrv文件中通过runserver.sh脚本调用Name Server的主函数com.alibaba.rocketmq.namesrv.NamesrvStartup启动Name Server)中的JAVA_OPT_1参数
[plain] view plaincopy在CODE上查看代码片派生到我的代码片
1 JAVA_OPT_1="-server -Xms512m -Xmx1g -XX:PermSize=128m -XX:MaxPermSize=320m"
3、创建数据目录
# mkdir -p /data/rocketmq/store/commitlog
# mkdir /data/logs
# cd conf/
# sed -i ‘s#${user.home}#/data#g‘ *.xml //将conf目录下所有xml文件中的${user.home}替换成/data,进入rocketmq/conf目录下执行该命令
4、启动RocketMQ
# cd ../bin/
# nohup sh mqnamesrv >/var/log/ns.log &
# nohup sh mqbroker -c ../conf/2m-noslave/broker-a.properties > /var/log/mq.log 2>&1 &
5、查看启动日志
# tail -f /var/log/ns.log
# tail -f /var/log/mq.log
6、查看启动端口
# netstat -tunpl
# jps
# kill -9 22596
# kill -9 22564
# kill -9 9967
# netstat -tunpl
# netstat -tunpl |grep java
7、关闭RocketMQ
# sh mqshutdown
1 Useage: mqshutdown broker | namesrv
# sh mqshutdown broker
# sh mqshutdown namesrv
8、再次启动
# nohup sh mqnamesrv >/var/log/ns.log &
# nohup sh mqbroker -c ../conf/2m-noslave/broker-a.properties > /var/log/mq.log 2>&1 &
9、验证状态
# jps
标签:
原文地址:http://www.cnblogs.com/babywaa/p/4874595.html