简体   繁体   English

Kafka - 此服务器不是该主题分区的领导者

[英]Kafka - This server is not the leader for that topic-partition

I have two broker kafka 0.10.2.0 cluster.Replication factor is 2. I am running 1.0.0 kafka stream application against this Kafka. 我有两个经纪人kafka 0.10.2.0 cluster.Replication factor是2.我正在对这个Kafka运行1.0.0 kafka流应用程序。 In my kafka stream application, producer config has retries = 10 and retry.backoff.ms = 100 在我的kafka流应用程序中,producer config的retries = 10 and retry.backoff.ms = 100

After running few minutes, I observed following logs in Kakfa server.log. 运行几分钟后,我在Kakfa server.log中观察了以下日志。 Due to this Kafka stream application is throwing 'NOT_LEADER_FOR_PARTITION' exception. 由于此Kafka流应用程序正在抛出'NOT_LEADER_FOR_PARTITION'异常。

What may be the possible reason? 可能的原因是什么? Please help me. 请帮我。

[2017-12-12 10:26:02,583] ERROR [ReplicaFetcherThread-0-1], Error for partition [__consumer_offsets,22] to broker 1:org.apache.kafka.common.errors.NotLeaderForPartitionException: This server is not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)

Each topic is served by one or multiple Brokers - one is leader and the remaining brokers are followers. 每个主题由一个或多个经纪人提供 - 一个是领导者,其余经纪人是追随者。

A producer needs to send new messages to the leader Broker which internally replicate the data to all followers. 生产者需要向领导者Broker发送新消息,Broker在内部将数据复制到所有关注者。

I assume, that your producer client does not connect to the correct Broker, its connect to a follower instead of the leader, and this follower rejects your send request. 我假设,您的生产者客户端没有连接到正确的Broker,它连接到跟随者而不是领导者,并且此关注者拒绝您的发送请求。

Try to run ./kafka-topics.sh --zookeeper localhost:2181 --topic your_topic --describe 尝试运行./kafka-topics.sh --zookeeper localhost:2181 --topic your_topic --describe

Topic:your_topic    PartitionCount:3    ReplicationFactor:1 Configs:retention.ms=14400000
Topic: your_topic   Partition: 0    Leader: 2   Replicas: 2 Isr: 2
Topic: your_topic   Partition: 1    Leader: 0   Replicas: 0 Isr: 0
Topic: your_topic   Partition: 2    Leader: 1   Replicas: 1 Isr: 1

In this example you can see that your_topic have 3 partitions meaning all 3 brokers are leaders of that topic each on different partition, st broker 2 is leader on partition 0 and broker 0 and broker 1 are followers on partition 0 . 在此示例中,您可以看到your_topic有3个分区,这意味着所有3个代理都是该主题的领导者,每个broker 2位于不同的分区上,st broker 2partition 0上的领导者, broker 0broker 1partition 0上的跟随者。

Try setting these properties and see if it helps resolve the issue: 尝试设置这些属性,看看它是否有助于解决问题:

props.put(ProducerConfig.RETRIES_CONFIG, 10);  //increase to 10 from default of 0
props.put(ConsumerConfig.MAX_POLL_INTERVAL_MS_CONFIG,   
    Integer.toString(Integer.MAX_VALUE)); // increase to infinity from default of 300 s

( Source ) 来源

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Kafka:此服务器不是该主题分区的领导者 - Kafka: This server is not the leader for that topic-partition kafka + 此服务器不是该主题分区的领导者 - kafka + This server is not the leader for that topic-partition kafka + 此服务器不是该主题分区的领导者 + kafka 生产者 - kafka + This server is not the leader for that topic-partition + kafka producer 运行Kafka性能流量时出现错误“此服务器不是该主题分区的领导者” - Error “This server is not the leader for that topic-partition” while running Kafka performance traffic Kafka 这个主题分区没有领导者,因为我们正在进行领导选举 - Kafka There is no leader for this topic-partition as we are in the middle of a leadership election org.apache.kafka.common.errors.NotLeaderForPartitionException:此服务器不是该主题分区的领导者 - 继续出现 - org.apache.kafka.common.errors.NotLeaderForPartitionException: This server is not the leader for that topic-partition - keep appearing 发送到Kafka REST-Proxy的邮件被“此服务器不是该主题分区的领导者”错误拒绝 - Messages sent to Kafka REST-Proxy being rejected by “This server is not the leader for that topic-partition” error org.apache.kafka.common.errors.UnknownTopicOrPartitionException:此服务器未托管此主题分区 - org.apache.kafka.common.errors.UnknownTopicOrPartitionException: This server does not host this topic-partition KAFKA 1.0-提取主题分区数据的未知错误 - KAFKA 1.0 - Unknown error fetching data for topic-partition spark stream kafka:提取主题分区数据的未知错误 - spark streaming kafka : Unknown error fetching data for topic-partition
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM