org.apache.kafka.common.errors.NotLeaderForPartit ionException: This server is not the leader for that topic-partition?

ighack 发表于: 2018-08-07   最后更新时间: 2018-09-18 09:48:58   8,405 游览

kafka生产端发送的时候会报:org.apache.kafka.common.errors.NotLeaderForPartit
ionException: This server is not the leader for that topic-partition.

server.log.2018-08-07-07日志里也有很多这个错误,网上主要是说由于切换partion的问题把生产端的retries改大一点。我现在的参数已经是3了。难到要改到7吗

我手动重发一下是可以成功的。这个地方还有别的需要改的吗?

发表于 2018-08-07
添加评论

兄弟,你的问题解决了吗?我遇到了相同的问题。

你是第一次发送的时候报这个错?

ighack -> 半兽人 5年前

是的。我们是调用一个服务,由这个服务往kafka里写数据。报错了以后。我们查了日志。有很多这个信息。一般都是差不一个时间点的。如果重新调用一下服务就好了。我们昨天重启了kafka现在没有这个错误日志了。不知道是怎么回事

ighack -> 半兽人 5年前

cat server.log.2018-08-07-14 | grep ERROR
[2018-08-07 14:19:06,271] ERROR [ReplicaFetcherThread-0-4], Error for partition [JLP_TO_LMIS_SHANGH,8] to broker 4:org.apache.kafka.common.errors.NotLeaderForPar
titionException: This server is not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)[2018-08-07 14:19:06,271] ERROR [ReplicaFetcherThread-0-4], Error for partition [consumer_offsets,8] to broker 4:org.apache.kafka.common.errors.NotLeaderForPar
titionException: This server is not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)[2018-08-07 14:19:06,271] ERROR [ReplicaFetcherThread-0-4], Error for partition [
consumer_offsets,28] to broker 4:org.apache.kafka.common.errors.NotLeaderForPa
rtitionException: This server is not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)[2018-08-07 14:19:06,271] ERROR [ReplicaFetcherThread-0-4], Error for partition [__consumer_offsets,48] to broker 4:org.apache.kafka.common.errors.NotLeaderForPa
rtitionException: This server is not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)[2018-08-07 14:19:06,271] ERROR [ReplicaFetcherThread-0-4], Error for partition [JLP_TO_LMIS_GD,3] to broker 4:org.apache.kafka.common.errors.NotLeaderForPartiti
onException: This server is not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)[2018-08-07 14:19:06,271] ERROR [ReplicaFetcherThread-0-4], Error for partition [Parallel_Computing_Bill_CS,5] to broker 4:org.apache.kafka.common.errors.NotLead
erForPartitionException: This server is not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)

ighack -> 半兽人 5年前

[2018-08-07 14:19:06,271] ERROR [ReplicaFetcherThread-0-4], Error for partition [JLP_TO_LMIS_SIC,9] to broker 4:org.apache.kafka.common.errors.NotLeaderForPartit
ionException: This server is not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)[2018-08-07 14:19:06,271] ERROR [ReplicaFetcherThread-0-4], Error for partition [mdb_Fd_Route_HEN,2] to broker 4:org.apache.kafka.common.errors.NotLeaderForParti
tionException: This server is not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)[2018-08-07 14:19:06,271] ERROR [ReplicaFetcherThread-0-4], Error for partition [Parallel_Computing_FD,0] to broker 4:org.apache.kafka.common.errors.NotLeaderFor
PartitionException: This server is not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)[2018-08-07 14:19:06,271] ERROR [ReplicaFetcherThread-0-4], Error for partition [Interface,0] to broker 4:org.apache.kafka.common.errors.NotLeaderForPartitionExc
eption: This server is not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)[2018-08-07 14:19:06,271] ERROR [ReplicaFetcherThread-0-4], Error for partition [TMP_TO_LMIS_HUB,2] to broker 4:org.apache.kafka.common.errors.NotLeaderForPartit
ionException: This server is not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)[2018-08-07 14:19:06,271] ERROR [ReplicaFetcherThread-0-4], Error for partition [JLP_TO_LMIS_BEIJ,3] to broker 4:org.apache.kafka.common.errors.NotLeaderForParti
tionException: This server is not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)[2018-08-07 14:19:06,271] ERROR [ReplicaFetcherThread-0-4], Error for partition [Parallel_Computing_Bill,3] to broker 4:org.apache.kafka.common.errors.NotLeaderF
orPartitionException: This server is not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)[2018-08-07 14:19:06,271] ERROR [ReplicaFetcherThread-0-4], Error for partition [mdb_Fd_Route_GZ,7] to broker 4:org.apache.kafka.common.errors.NotLeaderForPartit
ionException: This server is not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)[2018-08-07 14:19:06,271] ERROR [ReplicaFetcherThread-0-4], Error for partition [JLP_TO_LMIS_CHONGQ,3] to broker 4:org.apache.kafka.common.errors.NotLeaderForPar
titionException: This server is not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)

半兽人 -> ighack 5年前

第一次是主题创建报的这个错,可以忽视,如果丢消息,是说明你使用的是非阻塞发送。如果消费者优于生产者先启动,就都解决了

ighack -> 半兽人 5年前

我这个是在使用好一段时间之后出现的。生产者是一个服务。kafka一直在运行。直到前两发现问题不知道怎么解决才重启的

半兽人 -> ighack 5年前

你集群有别的错误吗? 除非你集群真的出故障了。

ighack -> 半兽人 5年前

cat state-change.log.2018-08-07-12 | grep ERROR
[2018-08-07 12:34:18,652] ERROR Broker 0 received LeaderAndIsrRequest with correlation id 1 from controller 2 epoch 49 for partition mdb_Fd_Consignor-0 but canno
t become follower since the new leader -1 is unavailable. (state.change.logger)[2018-08-07 12:34:18,652] ERROR Broker 0 received LeaderAndIsrRequest with correlation id 1 from controller 2 epoch 49 for partition mdb_Fd_Log_Cons-0 but cannot
 become follower since the new leader -1 is unavailable. (state.change.logger)[2018-08-07 12:34:18,652] ERROR Broker 0 received LeaderAndIsrRequest with correlation id 1 from controller 2 epoch 49 for partition mdb_Fd_Carrier-2 but cannot 
become follower since the new leader -1 is unavailable. (state.change.logger)[2018-08-07 12:34:18,653] ERROR Broker 0 received LeaderAndIsrRequest with correlation id 1 from controller 2 epoch 49 for partition mdb_Fd_Region-1 but cannot b
ecome follower since the new leader -1 is unavailable. (state.change.logger)[2018-08-07 12:34:18,653] ERROR Broker 0 received LeaderAndIsrRequest with correlation id 1 from controller 2 epoch 49 for partition mdb_Fd_Goods_Image-2 but can
not become follower since the new leader -1 is unavailable. (state.change.logger)[2018-08-07 12:34:18,653] ERROR Broker 0 received LeaderAndIsrRequest with correlation id 1 from controller 2 epoch 49 for partition mdb_Fd_Goods-0 but cannot be
come follower since the new leader -1 is unavailable. (state.change.logger)[2018-08-07 12:34:18,653] ERROR Broker 0 received LeaderAndIsrRequest with correlation id 1 from controller 2 epoch 49 for partition mdb_Fd_SupplySalesagency-2 b
ut cannot become follower since the new leader -1 is unavailable. (state.change.logger)[2018-08-07 12:34:18,653] ERROR Broker 0 received LeaderAndIsrRequest with correlation id 1 from controller 2 epoch 49 for partition mdb_Fd_Operator-2 but cannot
 become follower since the new leader -1 is unavailable. (state.change.logger)[2018-08-07 12:34:18,653] ERROR Broker 0 received LeaderAndIsrRequest with correlation id 1 from controller 2 epoch 49 for partition mdb_Fd_Ssa_Bank-1 but cannot
 become follower since the new leader -1 is unavailable. (state.change.logger)[2018-08-07 12:34:18,653] ERROR Broker 0 received LeaderAndIsrRequest with correlation id 1 from controller 2 epoch 49 for partition mdb_Fd_Ssa_Addr-2 but cannot
 become follower since the new leader -1 is unavailable. (state.change.logger)[2018-08-07 12:34:18,654] ERROR Broker 0 received LeaderAndIsrRequest with correlation id 1 from controller 2 epoch 49 for partition mdb_Fd_Con_License-1 but can
not become follower since the new leader -1 is unavailable. (state.change.logger)[2018-08-07 12:34:18,654] ERROR Broker 0 received LeaderAndIsrRequest with correlation id 1 from controller 2 epoch 49 for partition mdb_Fd_Vehicle-0 but cannot 
become follower since the new leader -1 is unavailable. (state.change.logger)

無名 -> ighack 5年前

大兄弟,你这集群很异常呢。

## 查询集群描述
bin/kafka-topics.sh --describe --zookeeper 

ighack -> 無名 5年前

由于我重启了,所以现在的输出不知道还有用吗?

Topic:JLP_TO_LMIS_GD PartitionCount:10 ReplicationFactor:3 Configs:

 Topic: JLP_TO_LMIS_GD Partition: 0 Leader: 0 Replicas: 0,1,2 Isr: 0,1,2

 Topic: JLP_TO_LMIS_GD Partition: 1 Leader: 1 Replicas: 1,2,3 Isr: 1,2,3

 Topic: JLP_TO_LMIS_GD Partition: 2 Leader: 2 Replicas: 2,3,4 Isr: 2,3,4

 Topic: JLP_TO_LMIS_GD Partition: 3 Leader: 3 Replicas: 3,4,0 Isr: 0,3,4

 Topic: JLP_TO_LMIS_GD Partition: 4 Leader: 4 Replicas: 4,0,1 Isr: 0,1,4

 Topic: JLP_TO_LMIS_GD Partition: 5 Leader: 0 Replicas: 0,2,3 Isr: 0,2,3

 Topic: JLP_TO_LMIS_GD Partition: 6 Leader: 1 Replicas: 1,3,4 Isr: 1,3,4

 Topic: JLP_TO_LMIS_GD Partition: 7 Leader: 2 Replicas: 2,4,0 Isr: 0,2,4

 Topic: JLP_TO_LMIS_GD Partition: 8 Leader: 3 Replicas: 3,0,1 Isr: 0,1,3

 Topic: JLP_TO_LMIS_GD Partition: 9 Leader: 4 Replicas: 4,1,2 Isr: 1,2,4

Topic:Parallel_Computing_Bill PartitionCount:10 ReplicationFactor:3 Configs:

 Topic: Parallel_Computing_Bill Partition: 0 Leader: 0 Replicas: 0,1,2 Isr: 0,1,2

 Topic: Parallel_Computing_Bill Partition: 1 Leader: 1 Replicas: 1,2,3 Isr: 1,2,3

 Topic: Parallel_Computing_Bill Partition: 2 Leader: 2 Replicas: 2,3,4 Isr: 2,3,4

 Topic: Parallel_Computing_Bill Partition: 3 Leader: 3 Replicas: 3,4,0 Isr: 0,3,4

 Topic: Parallel_Computing_Bill Partition: 4 Leader: 4 Replicas: 4,0,1 Isr: 0,1,4

 Topic: Parallel_Computing_Bill Partition: 5 Leader: 0 Replicas: 0,2,3 Isr: 0,2,3

 Topic: Parallel_Computing_Bill Partition: 6 Leader: 1 Replicas: 1,3,4 Isr: 1,3,4

 Topic: Parallel_Computing_Bill Partition: 7 Leader: 2 Replicas: 2,4,0 Isr: 0,2,4

 Topic: Parallel_Computing_Bill Partition: 8 Leader: 3 Replicas: 3,0,1 Isr: 0,1,3

 Topic: Parallel_Computing_Bill Partition: 9 Leader: 4 Replicas: 4,1,2 Isr: 1,2,4

ighack -> ighack 5年前

我随意的找了两个topic的输出,给您看一下

無名 -> ighack 5年前

这样看着是正常的,如果在出异常,你在查询下。

ighack -> 無名 5年前

[2018-09-05 14:49:21,228] INFO [ReplicaFetcherManager on broker 0] Removed fetcher for partitions Parallel_Computing_Stock_CS-0 (kafka.server.ReplicaFetcherManager)
[2018-09-05 14:49:21,230] ERROR [ReplicaFetcherThread-0-4], Error for partition [mdb_Fd_Route_JIANGS,5] to broker 4:org.apache.kafka.common.errors.NotLeaderForPartitionException: This server is not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)
[2018-09-05 14:49:21,230] ERROR [ReplicaFetcherThread-0-4], Error for partition [consumer_offsets,20] to broker 4:org.apache.kafka.common.errors.NotLeaderForPartitionException: This server is not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)
[2018-09-05 14:49:21,841] INFO [ReplicaFetcherManager on broker 0] Removed fetcher for partitions TMP_TO_LMIS_HEN-7 (kafka.server.ReplicaFetcherManager)
[2018-09-05 14:49:21,842] INFO [ReplicaFetcherManager on broker 0] Removed fetcher for partitions 
consumer_offsets-20 (kafka.server.ReplicaFetcherManager)
[2018-09-05 14:49:21,842] INFO [Group Metadata Manager on Broker 0]: Loading offsets and group metadata from consumer_offsets-20 (kafka.coordinator.GroupMetadataManager)
[2018-09-05 14:49:21,860] ERROR [ReplicaFetcherThread-0-3], Error for partition [JLP_TO_LMIS_JIANGS,4] to broker 3:org.apache.kafka.common.errors.NotLeaderForPartitionException: This server is not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)
[2018-09-05 14:49:21,860] ERROR [ReplicaFetcherThread-0-3], Error for partition [ParallelCompute_Persistence,1] to broker 3:org.apache.kafka.common.errors.NotLeaderForPartitionException: This server is not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)
[2018-09-05 14:49:21,860] ERROR [ReplicaFetcherThread-0-3], Error for partition [mdb_Fd_Route_JIANGX,6] to broker 3:org.apache.kafka.common.errors.NotLeaderForPartitionException: This server is not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)
[2018-09-05 14:49:21,860] ERROR [ReplicaFetcherThread-0-3], Error for partition [JLP_TO_LMIS_GZ,9] to broker 3:org.apache.kafka.common.errors.NotLeaderForPartitionException: This server is not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)
[2018-09-05 14:49:21,860] ERROR [ReplicaFetcherThread-0-3], Error for partition [MDB_TO_TMP,5] to broker 3:org.apache.kafka.common.errors.NotLeaderForPartitionException: This server is not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)
[2018-09-05 14:49:21,860] ERROR [ReplicaFetcherThread-0-3], Error for partition [LMIS_TO_JLP,4] to broker 3:org.apache.kafka.common.errors.NotLeaderForPartitionException: This server is not the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)
[2018-09-05 14:49:21,860] INFO [ReplicaFetcherManager on broker 0] Removed fetcher for partitions 
consumer_offsets-5 (kafka.server.ReplicaFetcherManager)

ighack -> 無名 5年前

Topic:JLP_TO_LMIS_JIANGS PartitionCount:10 ReplicationFactor:3 Configs:
 Topic: JLP_TO_LMIS_JIANGS Partition: 0 Leader: 1 Replicas: 1,4,0 Isr: 1,4,0
 Topic: JLP_TO_LMIS_JIANGS Partition: 1 Leader: 0 Replicas: 2,0,1 Isr: 1,0,2
 Topic: JLP_TO_LMIS_JIANGS Partition: 2 Leader: 3 Replicas: 3,1,2 Isr: 3,1
 Topic: JLP_TO_LMIS_JIANGS Partition: 3 Leader: 4 Replicas: 4,2,3 Isr: 4,3,2
 Topic: JLP_TO_LMIS_JIANGS Partition: 4 Leader: 0 Replicas: 0,3,4 Isr: 3,0,4
 Topic: JLP_TO_LMIS_JIANGS Partition: 5 Leader: 1 Replicas: 1,0,2 Isr: 1,0,2
 Topic: JLP_TO_LMIS_JIANGS Partition: 6 Leader: 1 Replicas: 2,1,3 Isr: 1,3,2
 Topic: JLP_TO_LMIS_JIANGS Partition: 7 Leader: 3 Replicas: 3,2,4 Isr: 3,4,2
 Topic: JLP_TO_LMIS_JIANGS Partition: 8 Leader: 4 Replicas: 4,3,0 Isr: 4,3,0
 Topic: JLP_TO_LMIS_JIANGS Partition: 9 Leader: 0 Replicas: 0,4,1 Isr: 0,4,1

ighack -> 無名 5年前

Topic:JLP_TO_LMIS_GZ PartitionCount:10 ReplicationFactor:3 Configs:
 Topic: JLP_TO_LMIS_GZ Partition: 0 Leader: 1 Replicas: 1,3,4 Isr: 1,4,3
 Topic: JLP_TO_LMIS_GZ Partition: 1 Leader: 4 Replicas: 2,4,0 Isr: 4,0,2
 Topic: JLP_TO_LMIS_GZ Partition: 2 Leader: 3 Replicas: 3,0,1 Isr: 3,0,1
 Topic: JLP_TO_LMIS_GZ Partition: 3 Leader: 4 Replicas: 4,1,2 Isr: 4,1,2
 Topic: JLP_TO_LMIS_GZ Partition: 4 Leader: 0 Replicas: 0,2,3 Isr: 3,0,2
 Topic: JLP_TO_LMIS_GZ Partition: 5 Leader: 1 Replicas: 1,4,0 Isr: 1,4,0
 Topic: JLP_TO_LMIS_GZ Partition: 6 Leader: 0 Replicas: 2,0,1 Isr: 1,0,2
 Topic: JLP_TO_LMIS_GZ Partition: 7 Leader: 3 Replicas: 3,1,2 Isr: 3,1
 Topic: JLP_TO_LMIS_GZ Partition: 8 Leader: 4 Replicas: 4,2,3 Isr: 4,3,2
 Topic: JLP_TO_LMIS_GZ Partition: 9 Leader: 0 Replicas: 0,3,4 Isr: 3,4,0

半兽人 -> ighack 5年前

不会自动恢复吗?

ighack -> 半兽人 5年前

会自己恢复
但我在cat kafkaServer.out | grep ERROR

看还看到很多ERROR [ReplicaFetcherThread-0-4], Error for partition [TMP_TO_LMIS_GD,6] to broker 4:org.apache.kafka.common.errors.NotLeaderForPartitionException: This server is no
t the leader for that topic-partition. (kafka.server.ReplicaFetcherThread)

半兽人 -> ighack 5年前

故障期间打错误是正常的吧。

ighack -> 半兽人 5年前

org.apache.kafka.common.errors.TimeoutException: Expiring 3 record(s) for sendemail-0: 30046 ms has passed since batch creation plus linger time
现在生产端有很多这样的错误。网上说是配制用的机器名。找不到IP,但我用的是IP没有配成机器名。而且我还修改是hosts文件将ip和机器对应
ping 值也很正常
./kafka-producer-perf-test.sh --topic sendemail --num-records 100 --record-size 1 --throughput 100  --producer-props
 bootstrap.servers=ip:port
100 records sent, 29.940120 records/sec (0.00 MB/sec), 1131.96 ms avg latency, 2855.00 ms max latency, 1209 ms 50th, 2715 ms 95th, 2855 ms 99th, 2855 ms 99.9th.
jzyc@jzyc1.com:/opt/kafka_2.11-0.10.2.1/bin# 
这个正式库比我测试库慢很多
./kafka-producer-perf-test.sh --topic audittest --num-records 100 --record-size 1 --throughput 100  --producer-prop
s bootstrap.servers=ip:port
100 records sent, 99.601594 records/sec (0.00 MB/sec), 6.60 ms avg latency, 199.00 ms max latency, 2 ms 50th, 18 ms 95th, 199 ms 99th, 199 ms 99.9th.
这个测试的都可以达到99正式的只有29,测试的机器只有三台机为集群,正式的为5台。测试机硬件配制远小于正式机

ighack -> 半兽人 5年前

get /brokers/ids/0
{"listener_security_protocol_map":{"PLAINTEXT":"PLAINTEXT"},"endpoints":["PLAINTEXT://10.3.87.23:9092"],"jmx_port":-1,"host":"10.3.87.23","timestamp":"1536131788
501","port":9092,"version":4}cZxid = 0x40002b0b8
ctime = Wed Sep 05 15:16:28 CST 2018
mZxid = 0x40002b0b8
mtime = Wed Sep 05 15:16:28 CST 2018
pZxid = 0x40002b0b8
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x165135ed2a70058
dataLength = 190
numChildren = 0


半兽人 -> ighack 5年前

1、如果主题不存在,第一次会出现告警级别的,就第一次,可忽略。
2、我看你描述,生产每天出现这种,你要检查集群之间的网络了,每个节点都要检查(重点看看哪些节点掉了)。
3、测试环境是你主动触发的关闭还是测试期间被动出现的?如果是被动的,那你要检查broker.id 2这个节点为什么会挂掉。

ighack -> 半兽人 5年前

昨天还有这样的问题

org.apache.kafka.common.errors.TimeoutException: Expiring 3 record(s) for sendemail-0: 30046 ms has passed since batch creation plus linger time
现在生产端有很多这样的错误。网上说是配制用的机器名。找不到IP,但我用的是IP没有配成机器名。而且我还修改是hosts文件将ip和机器对应
ping 值也很正常

ighack -> 半兽人 5年前

生产端的配制
props.put("acks", "1");
props.put("retries", 3);
props.put("batch.size", 16384);
props.put("linger.ms", 1);
props.put("buffer.memory", 33554432);


KafkaProducer<String,String> producer = new KafkaProducer<>(props);
        for(int i = 0; i < 2000; i++){
         logger.info(Thread.currentThread().getName() + "---beginTime:" + Integer.toString(i));
   Date d = new Date();
   String v = "{\"type\":\"cctssbsjcj\",\"bll\":\"{\\"sb_id\\":\\"1064868418687\\",\\"cj_date\\":\\"2018-09-05 16:08:00\\",\\"wd_data\\":\\"27.10\\",\\"cj_no\\":\\"XTS2018090500265000\\",\\"gps_area\\":\\"54538\\",\\"gps_sta\\":\\"29194\\",\\"sb_sign\\":\\"1\\",\\"sb_power\\":\\"100\\",\\"changetype\\":\\"inserted\\"}\"}";
            Future<RecordMetadata> meat = producer.send(new ProducerRecord<String, String>(topic, Integer.toString(i), v));
            try {
    RecordMetadata rm = meat.get();    //在这一句很慢,有时间报org.apache.kafka.common.errors.TimeoutException

    String key = rm.topic() + Integer.toString(rm.partition()) + Long.toString(rm.offset());
    logger.info("topic:" + rm.topic() + "  partition:" + rm.partition() + "   offset:" + rm.offset());
   } catch (InterruptedException | ExecutionException e) {
    e.printStackTrace();
   }
           
        }


半兽人 -> ighack 5年前

我怀疑你个别节点有问题,报超时就好说了。
1、先确认这2000条消息,是否全部成功,先定位出问题节点
2、检查server.properties,看看listeners都是ip:端口。

ighack -> 半兽人 5年前

我看了每个节点的server.properties 都是listeners=PLAINTEXT://ip:9092
每个节点进程都正常netstat -anp | 9092也看了
但好像没有连到集群中的所有机器

zookeeper日志中有
caught end of stream exception
EndOfStreamException: Unable to read additional data from client sessionid 0x265aa1781e3000c, likely client has closed socket
 at org.apache.zookeeper.server.NIOServerCnxn.doIO(NIOServerCnxn.java:239)
 at org.apache.zookeeper.server.NIOServerCnxnFactory.run(NIOServerCnxnFactory.java:203)
 at java.lang.Thread.run(Thread.java:745)

ighack -> 半兽人 5年前

netstat -anp | 9092
其中有这样的
tcp6       0      0 10.3.87.23:39963        10.3.87.24:9092         TIME_WAIT   -          
………………
tcp6       0      0 10.3.87.23:16411        10.3.87.24:9092         ESTABLISHED -        
………………
tcp6       1      0 10.3.87.23:58880        10.3.87.25:9092         CLOSE_WAIT  42771/java    
………………
tcp6       0      0 10.3.87.23:27210        10.3.87.25:9092         ESTABLISHED -        

ighack -> ighack 5年前

tcp6       0      0 10.3.87.23:27224        10.3.87.25:9092         ESTABLISHED -                   
tcp6       0      0 10.3.87.23:50257        10.3.87.23:9092         ESTABLISHED -                   
tcp6       0      0 10.3.87.23:57592        10.3.87.26:9092         ESTABLISHED 42771/java          
tcp6       0      0 10.3.87.23:31158        10.3.87.26:9092         ESTABLISHED -           

半兽人 -> ighack 5年前

你程序是直接拿官网例子,main直接运行的吗?

ighack -> 半兽人 5年前

是的,没有做什么修改

ighack -> 半兽人 4年前

而且我发现每过一段时间就会报这个错。好像是broker挂了。我看到zookeeper里有一些超时。超时间的时长正好是kafka设的超时的时长

ighack -> ighack 4年前

但又不是broker真的挂了。只是有些ISR挂了,就如上面的贴出的各主题状态

你的答案

查看kafka相关的其他问题或提一个您自己的问题