rockemq linux-集群搭建

一。修改每台主机的hosts文件 vi /.etc/hosts

120.77.61.XX nameserv1
120.76.232.XXX nameserv2

120.77.61.XX broker-a
120.76.232.XXX broker-b
120.77.61.XX broker-a-s
120.76.232.XXX broker-b-s

二。配置模板生成

mkdir ../conf/me-2m-2s-async/
sh mqbroker -m >../conf/me-2m-2s-async/broker.p

二。broker配置

拷贝生成的模板内容,打开需要修改的配置文件地址 cd /usr/local/RocketMQ-3.5.8/target/alibaba-rocketmq-broker/alibaba-rocketmq/conf/2m-2s-async


修改该文件夹下配置 vi broker-a.properties


namesrvAddr:为hosts中配置的nameserv

brokerIP1:为当前机器ip

brokerName:与host中配置一致

brokerId:0表示为master,大于0表示为slave

brokerRole:ASYNC_MASTER为主,SLAVE为从


namesrvAddr=nameserv1:9876;nameserv2:9876
brokerIP1=120.77.61.47
brokerName=broker-a
brokerClusterName=DefaultCluster
brokerId=0
autoCreateTopicEnable=true
autoCreateSubscriptionGroup=true
rejectTransactionMessage=false
fetchNamesrvAddrByAddressServer=false
storePathRootDir=/root/store
storePathCommitLog=/root/store/commitlog
flushIntervalCommitLog=1000
flushCommitLogTimed=false
deleteWhen=04
fileReservedTime=72
maxTransferBytesOnMessageInMemory=262144
maxTransferCountOnMessageInMemory=32
maxTransferBytesOnMessageInDisk=65536
maxTransferCountOnMessageInDisk=8
accessMessageInMemoryMaxRatio=40
messageIndexEnable=true
messageIndexSafe=false
haMasterAddress=
brokerRole=ASYNC_MASTER
flushDiskType=ASYNC_FLUSH
cleanFileForciblyEnable=true


三。复制broker-a.properties,broker-a-s.properties,broker-b.properties,broker-b-s.properties 到另外所有主机


注:为了让主broker crash时候能正常用,所以一台服务器放本服务master,而从放在另一台服务器如

120.77.61.XX 启动 broker-a 和broker-b-s

120.76.232.XXX 启动broker-b 和broker-a-s


四。启动每台机器nameserv 注:启动顺序namesrv-->broker,关闭顺序相反


进入以下目录:/usr/local/RocketMQ-3.5.8/target/alibaba-rocketmq-broker/alibaba-rocketmq/bin


    启动nameserv :nohup sh mqnamesrv > /usr/local/RocketMQ-3.5.8/logs/namesrv.log 2>&1 &


日志输出以下信息表示成功:The Name Server boot success. serializeType=JSON

五。启动每台broker

进入 /usr/local/RocketMQ-3.5.8/target/alibaba-rocketmq-broker/alibaba-rocketmq/bin

nohup sh mqbroker -nlocalhost:9876 autoCreateTopicEnable=true -c /usr/local/RocketMQ-3.5.8/target/alibaba-rocketmq-broker/alibaba-rocketmq/conf/2m-2s-async/broker-a.properties > /usr/local/RocketMQ-3.5.8/logs/broker.log 2>&1 &


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值