采用的是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://mirrors.tuna.tsinghua.edu.cn/apache/rocketmq/4.2.0/rocketmq-all-4.2.0-bin-release.zip
然后解压到某个目录, 比如: /data/rocketmq-4.2.0/
2.1 修改 192.168.1.100(master1)下的文件:/data/rocketmq-4.2.0/conf/2m-2s-async/broker-a.properties
vim /data/rocketmq-4.2.0/conf/2m-2s-async/broker-a.properties
增加如下内容:
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
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.2.0/store
storePathCommitLog=/data/rocketmq-4.2.0/store/commitlog
#消费队列存储路径存储路径
storePathConsumeQueue=/data/rocketmq-4.2.0/store/consumequeue
#消息索引存储路径
storePathIndex=/data/rocketmq-4.2.0/store/index
2.2 修改 192.168.1.101(master2)下的文件:/data/rocketmq-4.2.0/conf/2m-2s-async/broker-b.properties
内容同2.1,只是
brokerName=broker-b
2.3 修改 192.168.1.102(slave1)下的文件:/data/rocketmq-4.2.0/conf/2m-2s-async/broker-a-s.properties
内容同2.1,只是
brokerId=1
2.4 修改 192.168.1.103(slave2)下的文件:/data/rocketmq-4.2.0/conf/2m-2s-async/broker-b-s.properties
内容同2.3,只是
brokerId=1
3. 启动nameserver
登录四台服务器,执行如下启动命令
cd /data/rocketmq-4.2.0/bin
nohup sh mqnamesrv &
4. 启动broker