RocketMQ local cluster configuration

RocketMQ local cluster configuration

More complete configuration parameters reference

Modify the default port of NameServer to reach the local cluster configuration

Create a new configuration file conf/namesrv.properties in the conf directory. The file content is:

listenPort=2058

Use mqnamesrv - C.. / conf / namesrv.properties to specify the nameserver configuration file, for example:

PS E:\111softwares\rocketmq-all-4.4.0-bin-release\bin> .\mqnamesrv -c ../conf/namesrv.properties
"set java env ok."
Java HotSpot(TM) 64-Bit Server VM warning: Using the DefNew young collector with the CMS collector is deprecated and will likely be removed in a future release
Java HotSpot(TM) 64-Bit Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release.
load config properties file OK, ../conf/namesrv.properties
The Name Server boot success. serializeType=JSON

Configure Broker local cluster

./mqbroker -n localhost:9876 -c ../conf/2m-2s-sync/broker-a.properties

Specify nameserver in conf/broker-*.properties configuration file:

brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
autoCreateTopicEnable=true
namesrvAddr=localhost:9876;localhost:2058
listenPort=10911

2 Master 2 slave synchronization (2m-2s-sync) cluster configuration

2m-2s-sync Directory:

First master slave node

broker-a.properties

brokerClusterName=DefaultCluster
brokerName=broker-a
brokerId=0
deleteWhen=04
fileReservedTime=48
brokerRole=SYNC_MASTER
flushDiskType=ASYNC_FLUSH
namesrvAddr=localhost:9876;localhost:2058
listenPort=10911
# Whether Broker is allowed to automatically create Topic? It is recommended to open offline and close Online
autoCreateTopicEnable=true
#Storage path
storePathRootDir=/usr/local/rocketmq/store
#commitLog storage path
storePathCommitLog=/usr/local/rocketmq/store/commitlog
#Consumption queue storage path
storePathConsumeQueue=/usr/local/rocketmq/store/consumequeue
# Message index storage path
storePathIndex=/usr/local/rocketmq/store/index
# checkpoint file storage path
storeCheckpoint=/usr/local/rocketmq/store/checkpoint
#abort file storage path
abortFile=/usr/local/rocketmq/store/abort

broker-a-s.properties

brokerClusterName=DefaultCluster
brokerName=broker-a
brokerId=1
deleteWhen=04
fileReservedTime=48
brokerRole=SLAVE
flushDiskType=ASYNC_FLUSH
namesrvAddr=localhost:9876;localhost:2058
listenPort=20911
# Whether Broker is allowed to automatically create Topic? It is recommended to open offline and close Online
autoCreateTopicEnable=true
#Storage path
storePathRootDir=/usr/local/rocketmq/as/store
#commitLog storage path
storePathCommitLog=/usr/local/rocketmq/as/store/commitlog
#Consumption queue storage path
storePathConsumeQueue=/usr/local/rocketmq/as/store/consumequeue
# Message index storage path
storePathIndex=/usr/local/rocketmq/as/store/index
# checkpoint file storage path
storeCheckpoint=/usr/local/rocketmq/as/store/checkpoint
#abort file storage path
abortFile=/usr/local/rocketmq/as/store/abort

broker-b.properties

brokerClusterName=DefaultCluster
brokerName=broker-b
brokerId=0
deleteWhen=04
fileReservedTime=48
brokerRole=SYNC_MASTER
flushDiskType=ASYNC_FLUSH
namesrvAddr=localhost:9876;localhost:2058
listenPort=30911
# Whether Broker is allowed to automatically create Topic? It is recommended to open offline and close Online
autoCreateTopicEnable=true
#Storage path
storePathRootDir=/usr/local/rocketmq/bm/store
#commitLog storage path
storePathCommitLog=/usr/local/rocketmq/bm/store/commitlog
#Consumption queue storage path
storePathConsumeQueue=/usr/local/rocketmq/bm/store/consumequeue
# Message index storage path
storePathIndex=/usr/local/rocketmq/bm/store/index
# checkpoint file storage path
storeCheckpoint=/usr/local/rocketmq/bm/store/checkpoint
#abort file storage path
abortFile=/usr/local/rocketmq/bm/store/abort

broker-b-s.properties

brokerClusterName=DefaultCluster
brokerName=broker-b
brokerId=1
deleteWhen=04
fileReservedTime=48
brokerRole=SLAVE
flushDiskType=ASYNC_FLUSH
namesrvAddr=localhost:9876;localhost:2058
listenPort=40911
# Whether Broker is allowed to automatically create Topic? It is recommended to open offline and close Online
autoCreateTopicEnable=true
#Storage path
storePathRootDir=/usr/local/rocketmq/bs/store
#commitLog storage path
storePathCommitLog=/usr/local/rocketmq/bs/store/commitlog
#Consumption queue storage path
storePathConsumeQueue=/usr/local/rocketmq/bs/store/consumequeue
# Message index storage path
storePathIndex=/usr/local/rocketmq/bs/store/index
# checkpoint file storage path
storeCheckpoint=/usr/local/rocketmq/bs/store/checkpoint
#abort file storage path
abortFile=/usr/local/rocketmq/bs/store/abort

Execute in the bin directory, and start the Broker of the two primary and two secondary clusters in turn:

./mqbroker -n localhost:9876;localhost:2058 -c ../conf/2m-2s-sync/broker-a.properties
./mqbroker -n localhost:9876;localhost:2058 -c ../conf/2m-2s-sync/broker-a-s.properties
./mqbroker -n localhost:9876;localhost:2058 -c ../conf/2m-2s-sync/broker-b.properties
./mqbroker -n localhost:9876;localhost:2058 -c ../conf/2m-2s-sync/broker-b-s.properties

Keywords: Java JSON

Added by friedice on Sat, 16 Nov 2019 22:54:39 +0200