采用的是2m-2s-async模式
1. 修改每台机器的/etc/hosts 文件,增加如下内容
192.168.1.100 nameserver1
192.168.1.102 nameserver2
192.168.1.103 nameserver3
192.168.1.104 nameserver4
192.168.1.100 master1
192.168.1.101 master2
192.168.1.102 slave1
192.168.1.103 slave2
2. 下载bin压缩包: http://mirror.bit.edu.cn/apache/rocketmq/4.5.2/rocketmq-all-4.5.2-bin-release.zip
然后解压到某个目录, 比如: /data/rocketmq-4.5.2/
2.1 修改 192.168.1.100(master1)下的文件:/data/rocketmq-4.5.2/conf/2m-2s-async/broker-a.properties
vim /data/rocketmq-4.5.2/conf/2m-2s-async/broker-a.properties
增加如下内容:
brokerClusterName=EaglehornCluster brokerName=broker-a brokerId=0 namesrvAddr=nameserver1:9876;nameserver2:9876;nameserver3:9876;nameserver4:9876 autoCreateTopicEnable=true autoCreateSubscriptionGroup=true listenPort=10911 deleteWhen=04 fileReservedTime=48 brokerRole=ASYNC_MASTER flushDiskType=ASYNC_FLUSH storePathRootDir=/data/rocketmq-4.5.2/store storePathCommitLog=/data/rocketmq-4.5.2/store/commitlog #消费队列存储路径存储路径 storePathConsumeQueue=/data/rocketmq-4.5.2/store/consumequeue #消息索引存储路径 storePathIndex=/data/rocketmq-4.5.2/store/index
2.2 修改 192.168.1.101(master2)下的文件:/data/rocketmq-4.5.2/conf/2m-2s-async/broker-b.properties
内容同2.1,只是
brokerName=broker-b
2.3 修改 192.168.1.102(slave1)下的文件:/data/rocketmq-4.5.2/conf/2m-2s-async/broker-a-s.properties
内容同2.1,只是
brokerId=1
2.4 修改 192.168.1.103(slave2)下的文件:/data/rocketmq-4.5.2/conf/2m-2s-async/broker-b-s.properties
内容同2.3,只是
brokerId=1
3. 启动nameserver
登录四台服务器,执行如下启动命令
cd /data/rocketmq-4.5.2/bin
nohup sh mqnamesrv &
4. 启动broker
先启动2个master:
master1:
cd /data/rocketmq-4.5.2/bin
nohup sh mqbroker -c /data/rocketmq-4.5.2/conf/2m-2s-async/broker-a.properties &
master2:
cd /data/rocketmq-4.5.2/bin
nohup sh mqbroker -c /data/rocketmq-4.5.2/conf/2m-2s-async/broker-b.properties &
再启动2个slave:
cd /data/rocketmq-4.5.2/bin
nohup sh mqbroker -c /data/rocketmq-4.5.2/conf/2m-2s-async/broker-a-s.properties &
cd /data/rocketmq-4.5.2/bin
nohup sh mqbroker -c /data/rocketmq-4.5.2/conf/2m-2s-async/broker-b-s.properties &
5. 启动控制台: