kafka分区leader切换

发布于 2021-12-02 10:30:53 字数 3112 浏览 959 评论 2

kafka+storm构架
kafka 版本kafka_2.10-0.8.2.1,topic 副本数为2。zk版本3.4.6,storm版本apache-storm-0.9.4

近期storm消费总发现下面这样的报错:storm.kafka.FailedFetchException: Error fetching data from [Partition{host=xx.xx.xx.xx:9092, partition=11}] for topic [test]: [NOT_LEADER_FOR_PARTITION] at storm.kafka.KafkaUtils.fetchMessages
通过kafka-topics.sh --zookeeper localhost --describe,发现主从分区总有切换,如原本partition 0的leader 为broker 1,会变为broker 2。查看kafka日志,发现了下面的信息,但是没看太明白,网上也没找到解决办法。有没有人遇到过类似的情况?

[2015-09-01 13:45:12,402] WARN [Replica Manager on Broker 24]: Fetch request with correlation id 1553237 from client ReplicaFetcherThread-0-24 on partition [fortest2,7] failed due to Leader not local for partition [fortest2,7] on broker 24 (kafka.server.ReplicaManager)
[2015-09-01 13:45:16,938] WARN [KafkaApi-24] Produce request with correlation id 1843066 from client  on partition [fortest2,7] failed due to Leader not local for partition [fortest2,7] on broker 24 (kafka.server.KafkaApis)
[2015-09-01 13:45:12,406] ERROR [ReplicaFetcherThread-0-26], Error for partition [nginxlogtopic,10] to broker 26:class kafka.common.NotLeaderForPartitionException (kafka.server.ReplicaFetcherThread)
[2015-09-01 13:45:12,406] ERROR [ReplicaFetcherThread-0-26], Error for partition [udpToRead,6] to broker 26:class kafka.common.NotLeaderForPartitionException (kafka.server.ReplicaFetcherThread)
[2015-09-01 13:45:16,938] WARN [KafkaApi-24] Produce request with correlation id 1843066 from client  on partition [fortest2,15] failed due to Leader not local for partition [fortest2,15] on broker 24 (kafka.server.KafkaApis)
[2015-09-01 13:45:16,941] WARN [KafkaApi-24] Produce request with correlation id 1837853 from client  on partition [fortest2,7] failed due to Leader not local for partition [fortest2,7] on broker 24 (kafka.server.KafkaApis)
[2015-09-01 13:45:16,941] WARN [KafkaApi-24] Produce request with correlation id 1837853 from client  on partition [fortest2,15] failed due to Leader not local for partition [fortest2,15] on broker 24 (kafka.server.KafkaApis)
[2015-09-01 13:45:16,945] WARN [KafkaApi-24] Produce request with correlation id 1836177 from client  on partition [fortest2,7] failed due to Leader not local for partition [fortest2,7] on broker 24 (kafka.server.KafkaApis)
[2015-09-01 13:45:16,945] WARN [KafkaApi-24] Produce request with correlation id 1836177 from client  on partition [fortest2,15] failed due to Leader not local for partition [fortest2,15] on broker 24 (kafka.server.KafkaApis)
[2015-09-01 13:45:16,946] WARN [KafkaApi-24] Produce request with correlation id 1840172 from client  on partition [fortest2,7] failed due to Leader not local for partition [fortest2,7] on broker 24 (kafka.server.KafkaApis)
[2015-09-01 13:45:16,946] WARN [KafkaApi-24] Produce request with correlation id 1840172 from client  on partition [fortest2,15] failed due to Leader not local for partition [fortest2,15] on broker 24 (kafka.server.KafkaApis)

感觉应该是在某个broker down掉后,从分区接手时才应该切换。但是broker并没有down


如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

绝影如岚 2021-12-03 22:18:24

晕倒,我的是broker 宕掉后,重新起来就这样了。大师救救俺吧!

北笙凉宸 2021-12-03 18:20:52

你好,这个问题解决了么?是不是应为依赖的jar的问题?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文