Skip to content

Could not consumer messages from slave broker. #88

Closed

Description

@powerfulsnail

组网环境,当前3台服务器A(broker-a, broker-c-s)、B(broker-b, broker-a-s)、C(broker-c, broker-b-s),同步复制,异步刷盘,当发送多条异步消息后此时每台服务的broker上都有消息,从控制端上也可看到master的消息同步到slave上了,此时停掉broker-a的master,启动消费者去消费,发现无法从broker-a-s,即其slave上消费,这是什么原因?

Activity

  1. ShannonDing commented on Jan 30, 2019

    @ShannonDing
    Member

    Could you please add more information here, such as client logs?

  2. added
    question
    on Jan 30, 2019
  3. powerfulsnail commented on Jan 30, 2019

    @powerfulsnail
    Author

    部分日志:

    2019-Jan-30 16:41:27.664178:topic [MQ_TOPIC_EFC_SPESCIAL_ALARM] has :MessageQueue [topic=MQ_TOPIC_EFC_SPESCIAL_ALARM, brokerName=broker-c, queueId=13]
    2019-Jan-30 16:41:27.664190:topic [MQ_TOPIC_EFC_SPESCIAL_ALARM] has :MessageQueue [topic=MQ_TOPIC_EFC_SPESCIAL_ALARM, brokerName=broker-c, queueId=14]
    2019-Jan-30 16:41:27.664203:topic [MQ_TOPIC_EFC_SPESCIAL_ALARM] has :MessageQueue [topic=MQ_TOPIC_EFC_SPESCIAL_ALARM, brokerName=broker-c, queueId=15]
    2019-Jan-30 16:41:27.664220:updateTopicRouteInfoFromNameServer end:MQ_TOPIC_EFC_SPESCIAL_ALARM
    2019-Jan-30 16:41:27.664275:msg: The broker not exist,error:-1,in file </mnt/ssd/liuyufei/rocketmq-client-cpp-1.2.0/src/consumer/PullAPIWrapper.cpp> line:136
    2019-Jan-30 16:41:27.664304:updateTopicRouteInfoFromNameServer start:MQ_TOPIC_EFC_SPESCIAL_ALARM
    2019-Jan-30 16:41:27.664349:before insert declared filed,MAP SIZE is:2
    2019-Jan-30 16:41:27.664369:after insert declared filed, MAP SIZE is:3
    2019-Jan-30 16:41:27.664385:total msg info are:ALIYUNMQ_TOPIC_EFC_SPESCIAL_ALARM, size is:33
    2019-Jan-30 16:41:27.664916:fd:22, totalLen:533, bytesInMessage:529
    2019-Jan-30 16:41:27.664957:had received all data with len:533 from fd:22
    2019-Jan-30 16:41:27.665053:broker addr: 207.121.128.20, broker port: 9876
    2019-Jan-30 16:41:27.665076:brokerAddr:207.121.128.20:9876
    2019-Jan-30 16:41:27.665104: too little data received with sum = 0
    2019-Jan-30 16:41:27.665160:code:0, remark:JAVA, version:277, opaque:314330, flag:1, remark:, headLen:100, bodyLen:425
    2019-Jan-30 16:41:27.665205:find_response opaque:314330
    2019-Jan-30 16:41:27.665223:processResponseCommand, code:105,opaque:314330
    2019-Jan-30 16:41:27.665343:brokerName:broker-b
    2019-Jan-30 16:41:27.665384:brokerid:1,brokerAddr:207.121.128.40:10921
    2019-Jan-30 16:41:27.665408:brokerName:broker-c
    2019-Jan-30 16:41:27.665426:brokerid:0,brokerAddr:207.121.128.40:10911
    2019-Jan-30 16:41:27.665454:updateTopicRouteInfoFromNameServer has data
    2019-Jan-30 16:41:27.665486:topic [MQ_TOPIC_EFC_SPESCIAL_ALARM] has :MessageQueue [topic=MQ_TOPIC_EFC_SPESCIAL_ALARM, brokerName=broker-b, queueId=0]
    2019-Jan-30 16:41:27.665504:topic [MQ_TOPIC_EFC_SPESCIAL_ALARM] has :MessageQueue [topic=MQ_TOPIC_EFC_SPESCIAL_ALARM, brokerName=broker-b, queueId=1]
    2019-Jan-30 16:41:27.665520:topic [MQ_TOPIC_EFC_SPESCIAL_ALARM] has :MessageQueue [topic=MQ_TOPIC_EFC_SPESCIAL_ALARM, brokerName=broker-b, queueId=2]
    2019-Jan-30 16:41:27.665554:topic [MQ_TOPIC_EFC_SPESCIAL_ALARM] has :MessageQueue [topic=MQ_TOPIC_EFC_SPESCIAL_ALARM, brokerName=broker-b, queueId=3]
    2019-Jan-30 16:41:27.665570:topic [MQ_TOPIC_EFC_SPESCIAL_ALARM] has :MessageQueue [topic=MQ_TOPIC_EFC_SPESCIAL_ALARM, brokerName=broker-b, queueId=4]
    2019-Jan-30 16:41:27.665584:topic [MQ_TOPIC_EFC_SPESCIAL_ALARM] has :MessageQueue [topic=MQ_TOPIC_EFC_SPESCIAL_ALARM, brokerName=broker-b, queueId=5]
    2019-Jan-30 16:41:27.665598:topic [MQ_TOPIC_EFC_SPESCIAL_ALARM] has :MessageQueue [topic=MQ_TOPIC_EFC_SPESCIAL_ALARM, brokerName=broker-b, queueId=6]
    2019-Jan-30 16:41:27.665613:topic [MQ_TOPIC_EFC_SPESCIAL_ALARM] has :MessageQueue [topic=MQ_TOPIC_EFC_SPESCIAL_ALARM, brokerName=broker-b, queueId=7]

  4. powerfulsnail commented on Jan 30, 2019

    @powerfulsnail
    Author

    看源码发现
    void Rebalance::doRebalance() ——>
    m_pClientFactory->findConsumerIds ——>
    pTopicRouteData->selectBrokerAddr() ——>
    map<int, string>::iterator it1 = (*it).brokerAddrs.find(MASTER_ID)
    这里是只能找到MASTER_ID对应的Broker吗,而找不到SLAVE_ID对应的Broker

  5. jonnxu commented on Jan 30, 2019

    @jonnxu
    Contributor

    log:
    2019-Jan-30 22:50:11.988949:current topic is: test_topic
    2019-Jan-30 22:50:11.989051:msg: doRebalance the cidAll is empty,error:-1,in file </home/test/git/apache-rocketmq-client-cpp/src/consumer/Rebalance.cpp> line:106

  6. powerfulsnail commented on Jan 31, 2019

    @powerfulsnail
    Author

    看代码发现这个报错doRebalance the cidAll is empty是因为void Rebalance::doRebalance() ——>
    m_pClientFactory->findConsumerIds ——>
    pTopicRouteData->selectBrokerAddr() ——>
    map<int, string>::iterator it1 = (*it).brokerAddrs.find(MASTER_ID)只能找到MASTER_ID

  7. ifplusor commented on Mar 11, 2019

    @ifplusor
    Contributor

    @powerfulsnail could you please review #105 ? the PR will resolve this issue.

  8. powerfulsnail commented on Mar 12, 2019

    @powerfulsnail
    Author

    修改src/protocol/TopicRouteData.h后,重新编译测试还是没消费broker——slave上的消息

  9. ifplusor commented on Mar 12, 2019

    @ifplusor
    Contributor

    @powerfulsnail 还是因为 findConsumerIds 中获取不到 id 列表吗?

  10. powerfulsnail commented on Mar 12, 2019

    @powerfulsnail
    Author

    组网环境还是A(broker-a, broker-c-s)、B(broker-b, broker-a-s)、C(broker-c, broker-b-s),当发10000条同步消息到3个broker后,停掉一台服务器上的broker,进行消费,下面是日志

    2019-Mar-12 19:29:14.391940:updateTopicRouteInfoFromNameServer has data
    2019-Mar-12 19:29:14.392074:updateTopicRouteInfoFromNameServer start:MQ_TOPIC_EFC_COMMON_ALARM
    2019-Mar-12 19:29:14.392084:msg: The broker not exist,error:-1,in file </mnt/ssd/liuhongwei/rocketmq-client-cpp-1.2.1-rc1/src/consumer/PullAPIWrapper.cpp> line:136
    2019-Mar-12 19:29:14.392497:updateTopicRouteInfoFromNameServer has data
    2019-Mar-12 19:29:14.392631:updateTopicRouteInfoFromNameServer start:MQ_TOPIC_EFC_COMMON_ALARM
    2019-Mar-12 19:29:14.392641:msg: The broker not exist,error:-1,in file </mnt/ssd/liuhongwei/rocketmq-client-cpp-1.2.1-rc1/src/consumer/PullAPIWrapper.cpp> line:136
    2019-Mar-12 19:29:14.393060:updateTopicRouteInfoFromNameServer has data
    2019-Mar-12 19:29:14.393189:updateTopicRouteInfoFromNameServer start:%RETRY%group1
    2019-Mar-12 19:29:14.393199:msg: The broker not exist,error:-1,in file </mnt/ssd/liuhongwei/rocketmq-client-cpp-1.2.1-rc1/src/consumer/PullAPIWrapper.cpp> line:136
    2019-Mar-12 19:29:14.393615:updateTopicRouteInfoFromNameServer has data
    2019-Mar-12 19:29:14.393660:updateTopicRouteInfoFromNameServer start:MQ_TOPIC_EFC_COMMON_ALARM
    2019-Mar-12 19:29:14.393673:msg: The broker not exist,error:-1,in file </mnt/ssd/liuhongwei/rocketmq-client-cpp-1.2.1-rc1/src/consumer/PullAPIWrapper.cpp> line:136
    2019-Mar-12 19:29:14.394090:updateTopicRouteInfoFromNameServer has data
    2019-Mar-12 19:29:14.394223:updateTopicRouteInfoFromNameServer start:MQ_TOPIC_EFC_COMMON_ALARM
    2019-Mar-12 19:29:14.394233:msg: The broker not exist,error:-1,in file </mnt/ssd/liuhongwei/rocketmq-client-cpp-1.2.1-rc1/src/consumer/PullAPIWrapper.cpp> line:136
    2019-Mar-12 19:29:14.394639:updateTopicRouteInfoFromNameServer has data
    2019-Mar-12 19:29:14.394767:updateTopicRouteInfoFromNameServer start:MQ_TOPIC_EFC_COMMON_ALARM
    2019-Mar-12 19:29:14.394778:msg: The broker not exist,error:-1,in file </mnt/ssd/liuhongwei/rocketmq-client-cpp-1.2.1-rc1/src/consumer/PullAPIWrappe

  11. ifplusor commented on Mar 15, 2019

    @ifplusor
    Contributor

    @powerfulsnail please check new commit in #105 , i modify another function MQClientFactory::findBrokerAddressInSubscribe, which will select slave now.

  12. changed the title [-]多master,多slave情况下,broker的Master停掉之后,对应slave上的消息无法消费[/-] [+]Could not consumer messages from slave broker.[/+] on Mar 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions