返回到文章

采纳

编辑于 2年前

kafka生产应用中出现NotLeaderOrFollowerException,该如何解决?

kafka

kafka版本:kafka_2.11-1.1.1

近期线上总是会出现以下错误:

org.apache.kafka.common.errors.NotLeaderOrFollowerException: For requests intended only for the leader, this error indicates that the broker is not the current leader. For requests intended for any replica, this error indicates that the broker is not a replica of the topic partition.

从网上搜索了下,类似情况比较少,有的说是没有建topic/副本/分区情况,但和我目前情况不一致。希望能在这里得到答案。

集群描述:

Topic:risk_gateway_receive      PartitionCount:3        ReplicationFactor:2     Configs:
Topic: risk_gateway_receive     Partition: 0    Leader: 1       Replicas: 1,2   Isr: 1,2
Topic: risk_gateway_receive     Partition: 1    Leader: 2       Replicas: 2,0   Isr: 0,2
Topic: risk_gateway_receive     Partition: 2    Leader: 0       Replicas: 0,1   Isr: 0,1