本文共 6201 字,大约阅读时间需要 20 分钟。
192.168.241.101 paascloud-rocketmq-001192.168.241.102 paascloud-rocketmq-002
wget http://ftp.jaist.ac.jp/pub/apache/rocketmq/4.2.0/rocketmq-all-4.2.0-bin-release.zipscp rocketmq-all-4.2.0-bin-release.zip root@192.168.241.101:/root
unzip rocketmq-all-4.2.0-bin-release.zip -d /usr/local/rocketmq
vim /etc/profile
export ROCKETMQ_HOME=/usr/local/rocketmqexport PATH=$PATH::$ROCKETMQ_HOME/bin
# source /etc/profile
broker-a.properties
brokerClusterName=paascloud-rocketmq-clusterbrokerName=broker-abrokerId=0namesrvAddr=paascloud-rocketmq-001:9876;paascloud-rocketmq-002:9876;defaultTopicQueueNums=4autoCreateTopicEnable=trueautoCreateSubscriptionGroup=truelistenPort=10911deleteWhen=04fileReservedTime=120mapedFileSizeCommitLog=1073741824mapedFileSizeConsumeQueue=300000destroyMapedFileIntervalForcibly=120000redeleteHangedFileInterval=120000diskMaxUsedSpaceRatio=88storePathRootDir=/usr/local/rocketmq/data/master/storestorePathCommitLog=/usr/local/rocketmq/data/master/store/commitlogmaxMessageSize=65536flushCommitLogLeastPages=4flushConsumeQueueLeastPages=2flushCommitLogThoroughInterval=10000flushConsumeQueueThoroughInterval=60000checkTransactionMessageEnable=falsesendMessageThreadPoolNums=128pullMessageThreadPoolNums=128brokerRole=SYNC_MASTERflushDiskType=SYNC_FLUSH
broker-a-s.properties
brokerClusterName=paascloud-rocketmq-clusterbrokerName=broker-abrokerId=1namesrvAddr=paascloud-rocketmq-001:9876;paascloud-rocketmq-002:9876;defaultTopicQueueNums=4autoCreateTopicEnable=trueautoCreateSubscriptionGroup=truelistenPort=10921deleteWhen=04fileReservedTime=120mapedFileSizeCommitLog=1073741824mapedFileSizeConsumeQueue=300000destroyMapedFileIntervalForcibly=120000redeleteHangedFileInterval=120000diskMaxUsedSpaceRatio=88storePathRootDir=/usr/local/rocketmq/data/slave/storestorePathCommitLog=/usr/local/rocketmq/data/slave/store/commitlogmaxMessageSize=65536flushCommitLogLeastPages=4flushConsumeQueueLeastPages=2flushCommitLogThoroughInterval=10000flushConsumeQueueThoroughInterval=60000checkTransactionMessageEnable=falsesendMessageThreadPoolNums=128pullMessageThreadPoolNums=128brokerRole=SLAVEflushDiskType=SYNC_FLUSH
broker-b.properties
brokerClusterName=paascloud-rocketmq-clusterbrokerName=broker-bbrokerId=0namesrvAddr=paascloud-rocketmq-001:9876;paascloud-rocketmq-002:9876;defaultTopicQueueNums=4autoCreateTopicEnable=trueautoCreateSubscriptionGroup=truelistenPort=10911deleteWhen=04fileReservedTime=120mapedFileSizeCommitLog=1073741824mapedFileSizeConsumeQueue=300000destroyMapedFileIntervalForcibly=120000redeleteHangedFileInterval=120000diskMaxUsedSpaceRatio=88storePathRootDir=/usr/local/rocketmq/data/master/storestorePathCommitLog=/usr/local/rocketmq/data/master/store/commitlogmaxMessageSize=65536flushCommitLogLeastPages=4flushConsumeQueueLeastPages=2flushCommitLogThoroughInterval=10000flushConsumeQueueThoroughInterval=60000checkTransactionMessageEnable=falsesendMessageThreadPoolNums=128pullMessageThreadPoolNums=128brokerRole=SYNC_MASTERflushDiskType=SYNC_FLUSH
broker-b-s.properties
brokerClusterName=paascloud-rocketmq-clusterbrokerName=broker-bbrokerId=1namesrvAddr=paascloud-rocketmq-001:9876;paascloud-rocketmq-002:9876;defaultTopicQueueNums=4autoCreateTopicEnable=trueautoCreateSubscriptionGroup=truelistenPort=10921deleteWhen=04fileReservedTime=120mapedFileSizeCommitLog=1073741824mapedFileSizeConsumeQueue=300000destroyMapedFileIntervalForcibly=120000redeleteHangedFileInterval=120000diskMaxUsedSpaceRatio=88storePathRootDir=/usr/local/rocketmq/data/slave/storestorePathCommitLog=/usr/local/rocketmq/data/slave/store/commitlogmaxMessageSize=65536flushCommitLogLeastPages=4flushConsumeQueueLeastPages=2flushCommitLogThoroughInterval=10000flushConsumeQueueThoroughInterval=60000checkTransactionMessageEnable=falsesendMessageThreadPoolNums=128pullMessageThreadPoolNums=128brokerRole=SLAVEflushDiskType=SYNC_FLUSH
# mkdir -p /usr/local/rocketmq/data/master/store/commitlog# mkdir -p /usr/local/rocketmq/data/slave/store/commitlog# mkdir -p /usr/local/rocketmq/data/master/store/consumequeue# mkdir -p /usr/local/rocketmq/data/slave/store/consumequeue# mkdir -p /usr/local/rocketmq/data/master/store/index# mkdir -p /usr/local/rocketmq/data/slave/store/index# mkdir -p /usr/local/rocketmq/logs
cd /usr/local/rocketmq/conf && sed -i 's#${user.home}#/usr/local/rocketmq#g' *.xml
vim /usr/local/rocketmq/bin/runbroker.shJAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn512m"
vim /usr/local/rocketmq/bin/runserver.shJAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn512m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
nohup sh /usr/local/rocketmq/bin/mqnamesrv &
nohup sh /usr/local/rocketmq/bin/mqnamesrv &
nohup sh mqbroker -c /usr/local/rocketmq/conf/2m-2s-sync/broker-a.properties&
nohup sh mqbroker -c /usr/local/rocketmq/conf/2m-2s-sync/broker-a-s.properties&
nohup sh mqbroker -c /usr/local/rocketmq/conf/2m-noslave/broker-b.properties&
nohup sh mqbroker -c /usr/local/rocketmq/conf/2m-noslave/broker-b-s.properties&
# netstat -ntlp# jps# tail -f -n 500 /usr/local/rocketmq/logs/rocketmqlogs/broker.log# tail -f -n 500 /usr/local/rocketmq/logs/rocketmqlogs/namesrv.log
# sh /usr/local/rocketmq/bin/mqadmin clusterlist -n 192.168.241.101:9876
# sh /usr/local/rocketmq/bin/mqshutdown namesrv# sh /usr/local/rocketmq/bin/mqshutdown broker
# rm -rf /usr/local/rocketmq/data/master# rm -rf /usr/local/rocketmq/data/slave# mkdir -p /usr/local/rocketmq/data/master/store/commitlog# mkdir -p /usr/local/rocketmq/data/slave/store/commitlog# mkdir -p /usr/local/rocketmq/data/master/store/consumequeue# mkdir -p /usr/local/rocketmq/data/slave/store/consumequeue# mkdir -p /usr/local/rocketmq/data/master/store/index# mkdir -p /usr/local/rocketmq/data/slave/store/index
rocketmq-console-ng.bat
@echo off java -jar rocketmq-console-ng-1.0.0.jar --server.port=12581 --rocketmq.config.namesrvAddr=192.168.241.101:9876;192.168.241.102:9876; @pause
效果图