1
2
|
192.168.241.101 paascloud-rocketmq-001
192.168.241.102 paascloud-rocketmq-002
|
1
2
|
wget http://ftp.jaist.ac.jp/pub/apache/rocketmq/4.2.0/rocketmq-all-4.2.0-bin-release.zip
scp rocketmq-all-4.2.0-bin-release.zip [email protected]:/root
|
1
|
unzip rocketmq-all-4.2.0-bin-release.zip -d /usr/local/rocketmq
|
1
|
vim /etc/profile
|
1
2
|
export ROCKETMQ_HOME=/usr/local/rocketmq
export PATH=$PATH::$ROCKETMQ_HOME/bin
|
1
|
# source /etc/profile
|
broker-a.properties
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
brokerClusterName=paascloud-rocketmq-cluster
brokerName=broker-a
brokerId=0
namesrvAddr=paascloud-rocketmq-001:9876;paascloud-rocketmq-002:9876;
defaultTopicQueueNums=4
autoCreateTopicEnable=true
autoCreateSubscriptionGroup=true
listenPort=10911
deleteWhen=04
fileReservedTime=120
mapedFileSizeCommitLog=1073741824
mapedFileSizeConsumeQueue=300000
destroyMapedFileIntervalForcibly=120000
redeleteHangedFileInterval=120000
diskMaxUsedSpaceRatio=88
storePathRootDir=/usr/local/rocketmq/data/master/store
storePathCommitLog=/usr/local/rocketmq/data/master/store/commitlog
maxMessageSize=65536
flushCommitLogLeastPages=4
flushConsumeQueueLeastPages=2
flushCommitLogThoroughInterval=10000
flushConsumeQueueThoroughInterval=60000
checkTransactionMessageEnable=false
sendMessageThreadPoolNums=128
pullMessageThreadPoolNums=128
brokerRole=SYNC_MASTER
flushDiskType=SYNC_FLUSH
|
broker-a-s.properties
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
brokerClusterName=paascloud-rocketmq-cluster
brokerName=broker-a
brokerId=1
namesrvAddr=paascloud-rocketmq-001:9876;paascloud-rocketmq-002:9876;
defaultTopicQueueNums=4
autoCreateTopicEnable=true
autoCreateSubscriptionGroup=true
listenPort=10921
deleteWhen=04
fileReservedTime=120
mapedFileSizeCommitLog=1073741824
mapedFileSizeConsumeQueue=300000
destroyMapedFileIntervalForcibly=120000
redeleteHangedFileInterval=120000
diskMaxUsedSpaceRatio=88
storePathRootDir=/usr/local/rocketmq/data/slave/store
storePathCommitLog=/usr/local/rocketmq/data/slave/store/commitlog
maxMessageSize=65536
flushCommitLogLeastPages=4
flushConsumeQueueLeastPages=2
flushCommitLogThoroughInterval=10000
flushConsumeQueueThoroughInterval=60000
checkTransactionMessageEnable=false
sendMessageThreadPoolNums=128
pullMessageThreadPoolNums=128
brokerRole=SLAVE
flushDiskType=SYNC_FLUSH
|
broker-b.properties
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
brokerClusterName=paascloud-rocketmq-cluster
brokerName=broker-b
brokerId=0
namesrvAddr=paascloud-rocketmq-001:9876;paascloud-rocketmq-002:9876;
defaultTopicQueueNums=4
autoCreateTopicEnable=true
autoCreateSubscriptionGroup=true
listenPort=10911
deleteWhen=04
fileReservedTime=120
mapedFileSizeCommitLog=1073741824
mapedFileSizeConsumeQueue=300000
destroyMapedFileIntervalForcibly=120000
redeleteHangedFileInterval=120000
diskMaxUsedSpaceRatio=88
storePathRootDir=/usr/local/rocketmq/data/master/store
storePathCommitLog=/usr/local/rocketmq/data/master/store/commitlog
maxMessageSize=65536
flushCommitLogLeastPages=4
flushConsumeQueueLeastPages=2
flushCommitLogThoroughInterval=10000
flushConsumeQueueThoroughInterval=60000
checkTransactionMessageEnable=false
sendMessageThreadPoolNums=128
pullMessageThreadPoolNums=128
brokerRole=SYNC_MASTER
flushDiskType=SYNC_FLUSH
|
broker-b-s.properties
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
brokerClusterName=paascloud-rocketmq-cluster
brokerName=broker-b
brokerId=1
namesrvAddr=paascloud-rocketmq-001:9876;paascloud-rocketmq-002:9876;
defaultTopicQueueNums=4
autoCreateTopicEnable=true
autoCreateSubscriptionGroup=true
listenPort=10921
deleteWhen=04
fileReservedTime=120
mapedFileSizeCommitLog=1073741824
mapedFileSizeConsumeQueue=300000
destroyMapedFileIntervalForcibly=120000
redeleteHangedFileInterval=120000
diskMaxUsedSpaceRatio=88
storePathRootDir=/usr/local/rocketmq/data/slave/store
storePathCommitLog=/usr/local/rocketmq/data/slave/store/commitlog
maxMessageSize=65536
flushCommitLogLeastPages=4
flushConsumeQueueLeastPages=2
flushCommitLogThoroughInterval=10000
flushConsumeQueueThoroughInterval=60000
checkTransactionMessageEnable=false
sendMessageThreadPoolNums=128
pullMessageThreadPoolNums=128
brokerRole=SLAVE
flushDiskType=SYNC_FLUSH
|
1
2
3
4
5
6
7
|
# 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
|
1
|
cd /usr/local/rocketmq/conf && sed -i 's#${user.home}#/usr/local/rocketmq#g' *.xml
|
1
2
|
vim /usr/local/rocketmq/bin/runbroker.sh
JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn512m"
|
1
2
|
vim /usr/local/rocketmq/bin/runserver.sh
JAVA_OPT="${JAVA_OPT} -server -Xms1g -Xmx1g -Xmn512m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
|
1
|
nohup sh /usr/local/rocketmq/bin/mqnamesrv &
|
1
|
nohup sh /usr/local/rocketmq/bin/mqnamesrv &
|
1
|
nohup sh mqbroker -c /usr/local/rocketmq/conf/2m-2s-sync/broker-a.properties&
|
1
|
nohup sh mqbroker -c /usr/local/rocketmq/conf/2m-2s-sync/broker-a-s.properties&
|
1
|
nohup sh mqbroker -c /usr/local/rocketmq/conf/2m-noslave/broker-b.properties&
|
1
|
nohup sh mqbroker -c /usr/local/rocketmq/conf/2m-noslave/broker-b-s.properties&
|
1
2
3
4
|
# 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
|
1
|
# sh /usr/local/rocketmq/bin/mqadmin clusterlist -n 192.168.241.101:9876
|
1
2
|
# sh /usr/local/rocketmq/bin/mqshutdown namesrv
# sh /usr/local/rocketmq/bin/mqshutdown broker
|
1
2
3
4
5
6
7
8
|
# 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
1
2
3
|
@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
|
https://www.jianshu.com/p/9d4e0ff358c6
http://blog.csdn.net/lovesomnus/article/details/51769977