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.测试查看:
[[email protected]]# 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
(2)Master-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
时间: 2024-10-11 13:08:46