rocketmq 主从高可用测试
SYNC_MASTER SYNC_FLUSH
1.场景一:slave停掉
普通消息:
生产者发送消息:返回内容
SendResult [sendStatus=SLAVE_NOT_AVAILABLE, msgId=C0A8023C387418B4AAC25093B3990000, offsetMsgId=0A0A106700002A9F00000007BA319289, messageQueue=MessageQueue [topic=test, brokerName=broker-a, queueId=1], queueOffset=2]
消费者能够正常消费这条消息
事物消息:
生产发送消息:返回内容异常
Exception in thread "main" com.maihaoche.starter.mq.MQException: 事务消息发送失败,topic :test-transaction,e:事务消息发送失败,topic :test-transaction, status :SLAVE_NOT_AVAILABLE
消费者能够不能消费这条消息
1.场景二:master 停掉
Exception in thread "main" com.maihaoche.starter.mq.MQException: 消息发送失败,topic :test,e:No route info of this topic, test
See http://rocketmq.apache.org/docs/faq/ for further details.
at com.maihaoche.starter.mq.base.AbstractMQProducer.syncSend(AbstractMQProducer.java:41)
at com.test.mq.DemoApplication.main(DemoApplication.java:21)
消费者会去读slave得消费进度进行消息消费
当master再启动起来时候,又会读master得消费进度,会进行重复消费
测试场景:
1.主从是否同步数据一致
生产发送消息,突然把master停掉。然后消费者去slave消费数据。看消费得数据是否和发送得数据相同
2.master挂了是否可以发送消息,是否可以消费消息
生产发送消息根据结果判断,消费者消费消息是否正常
3.master恢复,消费进度从哪开始
根据控制台显示,master恢复,消费以maseter进度为准
4.slave挂了是否可以正常发送消息,消费消息
普通消息可以正常发送,但返回结果:会又状态提示,根据业务做出处理SLAVE_NOT_AVAILABLE。消费消息是正常得
事物消息发送失败