10.1.0.178 配置文件
broker-a-m.properties
brokerClusterName=PaymentCluster
brokerName=broker-a
namesrvAddr=10.1.0.178:9876;10.1.0.179:9876
brokerId=0
listenPort=10921
brokerIP1=10.1.0.178
deleteWhen=04
fileReservedTime=72
brokerRole=ASYNC_MASTER
storePathRootDir=/data/rocketmq/a-m/rootdir
storePathCommitLog=/data/rocketmq/a-m/commitlog
defaultTopicQueueNums=4
autoCreateTopicEnable=true
autoCreateSubscriptionGroup=true
flushDiskType=ASYNC_FLUSH
10.1.0.179 配置文件
broker-a-s.properties
brokerClusterName=PaymentCluster
brokerName=broker-a
namesrvAddr=10.1.0.178:9876;10.1.0.179:9876
brokerId=1
listenPort=10911
brokerIP1=10.1.0.179
deleteWhen=04
fileReservedTime=72
brokerRole=SLAVE
storePathRootDir=/data/rocketmq/a-s/rootdir
storePathCommitLog=/data/rocketmq/a-s/commitlog
defaultTopicQueueNums=4
autoCreateTopicEnable=true
autoCreateSubscriptionGroup=true
flushDiskType=ASYNC_FLUSH
在安装目录下创建启动脚本
startNameServer.sh脚本
#!/bin/bash
mqLogDir=$ROCKETMQ_LOG
if [ ! -n "$mqLogDir" ];then
mqLogDir=`pwd`/logs
fi
echo $mqLogDir
nohup bin/mqnamesrv >$mqLogDir/mqnamesrv.log 2>&1 &
startBroker.sh脚本
#!/bin/bash
if [ ! -n "$1" ];then
echo 'please specify config name'
exit 1
fi
mqLogDir=`pwd`
confFile=$mqLogDir/conf/$1.properties
logFile=$mqLogDir/logs/$1.log
echo $ROCKETMQ_LOG
echo $confFile
echo $logFile
nohup bin/mqbroker -c $confFile > $logFile 2>&1 &
官方配置启动内存为nameserver 4g, broker 8g, 如果需要可根据实际情况配置 runserver.sh和 runbroker.sh。
开启
sh startNameServer.sh
sh startBroker.sh broker-a-m
sh startBroker.sh broker-a-s
关闭
sh bin/mqshutdown broker
sh bin/mqshutdown namesrv
起开 rocketmq-console 监控后台
nohup java -Xmx1024m -Drocketmq.namesrv.addr="172.16.235.105:9876;172.16.235.106:9876" -Dcom.rocketmq.sendMessageWithVIPChannel=false -jar rocketmq-console-ng-1.0.0.jar &