Machine preparation
Two independent linux hosts with IP of 172.31.175.142/143
172.31.175.142 | NameServer1, Broker Master1 |
172.31.175.143 | NameServer2, Broker Master2 |
Installation configuration
install
Download the binary version and extract it
wget http://mirrors.hust.edu.cn/apache/rocketmq/4.3.0/rocketmq-all-4.3.0-bin-release.zip unzip rocketmq-all-4.3.0-bin-release.zip -d ~ cd ~ mv rocketmq-all-4.3.0-bin-release rocketmq
Start NameServer
The std output of the command uses the default run log
mkdir -p ~/logs/rocketmqlogs nohup sh bin/mqnamesrv >~/logs/rocketmqlogs/namesrv.log 2>&1 & tail -100f ~/logs/rocketmqlogs/namesrv.log
Configure / start Broker
1) master1
Enter 172.31.175.142, edit the preset configuration file conf/2m-noslave/broker-a.properties, and add the namesrv address
namesrvAddr=172.31.175.142:9876;172.31.175.143:9876 brokerClusterName=DefaultCluster brokerName=broker-a brokerId=0 deleteWhen=04 fileReservedTime=48 brokerRole=ASYNC_MASTER flushDiskType=ASYNC_FLUSH
Start broker, specify the configuration file broker-a.properties
nohup sh bin/mqbroker -c ~/rocketmq/conf/2m-noslave/broker-a.properties >~/logs/rocketmqlogs/broker.log 2>&1 & tail -100f ~/logs/rocketmqlogs/broker.log
2) master2
Enter 172.31.175.143, edit the preset configuration file conf/2m-noslave/broker-b.properties, and add the namesrv address
namesrvAddr=172.31.175.142:9876;172.31.175.143:9876 brokerClusterName=DefaultCluster brokerName=broker-b brokerId=0 deleteWhen=04 fileReservedTime=48 brokerRole=ASYNC_MASTER flushDiskType=ASYNC_FLUSH
Start broker and specify the configuration file broker-b.properties
nohup sh bin/mqbroker -c ~/rocketmq/conf/2m-noslave/broker-b.properties >~/logs/rocketmqlogs/broker.log 2>&1 & tail -100f ~/logs/rocketmqlogs/broker.log
View cluster status
sh bin/mqadmin clusterlist -n 172.31.175.142:9876;172.31.175.143:9876
The dual master cluster information is as follows
#Cluster Name #Broker Name #BID #Addr #Version #InTPS(LOAD) #OutTPS(LOAD) #PCWait(ms) #Hour #SPACE DefaultCluster broker-a 0 172.31.175.142:10911 V4_3_0 0.00(0,0ms) 0.00(0,0ms) 0 427546.59 -1.0000 DefaultCluster broker-b 0 172.31.175.143:10911 V4_3_0 0.00(0,0ms) 0.00(0,0ms) 0 427546.59 -1.0000