回放
RocketMQ配置方式为2m-noslave模式,当$宕机后,导致消息虽然发送至MQ内,就是不能够消费。
替代变量
MQ节点一地址:${Mq_Addr_1}
MQ节点二地址:${Mq_Addr_2}
MQ集群名称:${Mq_Cluster_Name}
broker-a.properties
namesrvAddr=${Mq_Addr_1}:9876;${Mq_Addr_2}:9876
brokerIP1=${Mq_Addr_1}
brokerName=${Mq_Addr_1}
brokerClusterName=${Mq_Cluster_Name}
brokerId=0
autoCreateTopicEnable=false
autoCreateSubscriptionGroup=true
rejectTransactionMessage=false
fetchNamesrvAddrByAddressServer=false
storePathRootDir=/usr/local/alibaba-rocketmq/store
storePathCommitLog=/usr/local/alibaba-rocketmq/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-b.properties
namesrvAddr=${Mq_Addr_1}:9876;${Mq_Addr_2}:9876
brokerIP1=${Mq_Addr_2}
brokerName=${Mq_Addr_2}
brokerClusterName=${Mq_Cluster_Name}
brokerId=0
autoCreateTopicEnable=true
autoCreateSubscriptionGroup=true
rejectTransactionMessage=false
fetchNamesrvAddrByAddressServer=false
storePathRootDir=/usr/local/alibaba-rocketmq/store
storePathCommitLog=/usr/local/alibaba-rocketmq/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
启动方式
# 共用命令
/usr/local/alibaba-rocketmq/bin/mqnamesrv &> /usr/local/alibaba-rocketmq/store/mqnamesrv.log &
# 节点a 启动
/usr/local/alibaba-rocketmq/bin/mqbroker -c /usr/local/alibaba-rocketmq/conf/2m-noslave/broker-a.properties &
# 节点b 启动
/usr/local/alibaba-rocketmq/bin/mqbroker -c /usr/local/alibaba-rocketmq/conf/2m-noslave/broker-b.properties &
解决方案
更换b节点;或者下掉b节点,从配置文件中删除相关节点配置,重启mq即可