码迷,mamicode.com
首页 > 其他好文 > 详细

RocketMQ-04安装

时间:2015-07-12 15:53:54      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:rocketmq

1.rocketmq

1) Maven环境

a.下载

apache-maven-3.3.3-bin.tar.gz

b.解压

tar -zxfapache-maven-3.3.3-bin.tar.gz

c.加入环境变量

MAVEN="/data/Application/apache-maven/bin"
JAVA_HOME="/usr/java/jdk1.7.0_45/"
exportPATH=$MAVEN:/usr/java/jdk1.7.0_45/bin/:/usr/local/mysql/bin/:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sersync/bin:/root/bin

加入到PATH下

d.测试查看:

[root@IQJ-JQ-RocketMQ100-34tools]# mvn -version
ApacheMaven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06;2015-04-22T19:57:37+08:00)
Mavenhome: /data/Application/apache-maven
Javaversion: 1.7.0_45, vendor: Oracle Corporation
Javahome: /usr/java/jdk1.7.0_45/jre
Defaultlocale: en_US, platform encoding: UTF-8
OS name:"linux", version: "2.6.32-431.el6.x86_64", arch:"amd64", family: "unix"

 

2) RocketMQ

       a.安装

alibaba-rocketmq-3.2.6.tar.gz
#→解压至/data/Application目录
tar -zxfalibaba-rocketmq-3.2.6.tar.gz
mvalibaba-rocketmq rocketmq
mvrocketmq /data/Application
执行优化脚本os.sh(/data/server/scripts/os.sh)

 

b.主主配置

cd /data/Application/rocketmq&& mkdir data/store/commitlog -p
cd /data/Application/rocketmq/conf&& sed -i ‘s#${user.home}#/data#g‘ *.xml

             

(1)    Master-a配置

$ vim 2m-noslave/broker-a.properties
 
brokerClusterName=AdpMqCluster
brokerName=broker-a
brokerId=0
namesrvAddr=RocketMQ01:9876;RocketMQ02:9876
defaultTopicQueueNums=4
autoCreateTopicEnable=true
autoCreateSubscriptionGroup=true
listenPort=10911
deleteWhen=04
fileReservedTime=120
mapedFileSizeCommitLog=1073741824
mapedFileSizeConsumeQueue=50000000
destroyMapedFileIntervalForcibly=120000
redeleteHangedFileInterval=120000
diskMaxUsedSpaceRatio=88
storePathRootDir=/data/Application/rocketmq/data/store
storePathCommitLog=/data/Application/rocketmq/data/store/commitlog
maxMessageSize=65536
flushCommitLogLeastPages=4
flushConsumeQueueLeastPages=2
flushCommitLogThoroughInterval=10000
flushConsumeQueueThoroughInterval=60000
brokerRole=ASYNC_MASTER
flushDiskType=ASYNC_FLUSH
checkTransactionMessageEnable=false
sendMessageThreadPoolNums=128
pullMessageThreadPoolNums=128

        

 

              2Master-b配置

 $ vim2m-noslave/broker-b.properties
 
brokerClusterName=AdpMqCluster
brokerName=broker-b
brokerId=1
namesrvAddr=RocketMQ01:9876;RocketMQ02:9876
defaultTopicQueueNums=4
autoCreateTopicEnable=true
autoCreateSubscriptionGroup=true
listenPort=10911
deleteWhen=04
fileReservedTime=120
mapedFileSizeCommitLog=1073741824
mapedFileSizeConsumeQueue=50000000
destroyMapedFileIntervalForcibly=120000
redeleteHangedFileInterval=120000
diskMaxUsedSpaceRatio=88
storePathRootDir=/data/Application/rocketmq/data/store
storePathCommitLog=/data/Application/rocketmq/data/store/commitlog
maxMessageSize=65536
flushCommitLogLeastPages=4
flushConsumeQueueLeastPages=2
flushCommitLogThoroughInterval=10000
flushConsumeQueueThoroughInterval=60000
brokerRole=ASYNC_MASTER
flushDiskType=ASYNC_FLUSH
checkTransactionMessageEnable=false
sendMessageThreadPoolNums=128
pullMessageThreadPoolNums=128

 

       (3)runbroker.sh参数调整

runbroker.sh需要根据内存大小进行适当地调整

JAVA_OPT="${JAVA_OPT}-server -Xms32g -Xmx32g -Xmn8g -XX:PermSize=1g -XX:MaxPermSize=1g"

 

PS: 配置权限

chown -Rnobody.nobody Application

 

       (4)服务启动(此处用root启动的)

  PS:在这里需要修改runserver.sh

           技术分享

  注释检测JAVA_HOME地址一行,提供加入JAVA地址.否则启动有错误

 

              a.启动NameServer[master-a,master-b]

       cd /data/Application/rocketmq/bin
       sudo -u nobody nohup sh/data/Application/rocketmq/bin/mqnamesrv &
              b.启动BrokerA[master-a]
       sudo -u nobody nohup sh/data/Application/rocketmq/bin/mqbroker -c/data/Application/rocketmq/conf/2m-noslave/broker-a.properties >/dev/null2>&1 &
              c.启动BrokerB[master-b]
       sudo -u nobody nohup sh/data/Application/rocketmq/bin/mqbroker -c/data/Application/rocketmq/conf/2m-noslave/broker-b.properties >/dev/null2>&1 &

              d.检查

  netstat -lntp |grep -E ‘9876|109‘
       jps

3) RocketMQ服务健康检查

1.依赖组件

yuminstall -y namp

 

2.nameserver监控

请查看附件

 

 

4) web平台监控

安装tomcat

    这里就省略了。

 

war放入webapps下,修改vimWEB-INF/classes/config.properties

rocketmq.namesrv.addr=RocketMQ01:9876   #这里只能写一个

throwDone=true


本文出自 “崛起” 博客,请务必保留此出处http://binbinwudi8688.blog.51cto.com/3023365/1673372

RocketMQ-04安装

标签:rocketmq

原文地址:http://binbinwudi8688.blog.51cto.com/3023365/1673372

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!