参照:https://github.com/apache/rocketmq/blob/master/docs/cn/operation.md
1、修改配置文件conf\2m-2s-async
broker-a.properties
brokerClusterName=DefaultCluster
brokerName=broker-a
brokerId=0
deleteWhen=04
fileReservedTime=48
brokerRole=ASYNC_MASTER
flushDiskType=ASYNC_FLUSH
#同一台机器上的broker的端口号相差大一点,不然会报错地址已被绑定
# https://www.likecs.com/show-204784161.html
listenPort=10911
brokerIP1 = 127.0.0.1
namesrvAddr = 127.0.0.1:9876
#存储路径
storePathRootDir=E:\\SelfStudy\\rocketmq_jq\\store1
broker-a-s.properties
brokerClusterName=DefaultCluster
brokerName=broker-a
brokerId=1
deleteWhen=04
fileReservedTime=48
brokerRole=SLAVE
flushDiskType=ASYNC_FLUSH
#同一台机器上的broker的端口号相差大一点
#https://www.likecs.com/show-204784161.html
listenPort=10920
brokerIP1 = 127.0.0.1
namesrvAddr = 127.0.0.1:9876
#存储路径
storePathRootDir=E:\\SelfStudy\\rocketmq_jq\\store2
broker-b.properties
brokerClusterName=DefaultCluster
brokerName=broker-b
brokerId=0
deleteWhen=04
fileReservedTime=48
brokerRole=ASYNC_MASTER
flushDiskType=ASYNC_FLUSH
#同一台机器上的broker的端口号相差大一点
#https://www.likecs.com/show-204784161.html
listenPort=10930
brokerIP1 = 127.0.0.1
namesrvAddr = 127.0.0.1:9876
#存储路径
storePathRootDir=E:\\SelfStudy\\rocketmq_jq\\store3
broker-b-s.properties
brokerClusterName=DefaultCluster
brokerName=broker-b
brokerId=1
deleteWhen=04
fileReservedTime=48
brokerRole=SLAVE
flushDiskType=ASYNC_FLUSH
#同一台机器上的broker的端口号相差大一点
#https://www.likecs.com/show-204784161.html
listenPort=10940
brokerIP1 = 127.0.0.1
namesrvAddr = 127.0.0.1:9876
#存储路径
storePathRootDir=E:\\SelfStudy\\rocketmq_jq\\store4
2、创建storePathRootDir文件夹
就是配置文件里storePathRootDir对应的文件夹
3、复制四份修改配置文件后的rocketmq-4.9.4
4、进入rocketmq-1的bin目录下启动nameserver
mqnamesrv.cmd -n localhost:9876
5、分别进入对应的rocketmq的bin目录下执行命令,启动broker
# 在rocketmq-1\bin下执行
mqbroker.cmd -n localhost:9876 -c ../conf/2m-2s-async/broker-a.properties
# 在rocketmq-2\bin下执行
mqbroker.cmd -n localhost:9876 -c ../conf/2m-2s-async/broker-a-s.properties
# 在rocketmq-3\bin下执行
mqbroker.cmd -n localhost:9876 -c ../conf/2m-2s-async/broker-b.properties
# 在rocketmq-4\bin下执行
mqbroker.cmd -n localhost:9876 -c ../conf/2m-2s-async/broker-b-s.properties
6、仪表板观察集群