Kafka-在分区0的MYTOPIC-X上,偏移提交失败

时间:2019-02-17 10:19:54

标签: apache-kafka kafka-consumer-api

当系统处于空闲状态并且启用了自动提交偏移量时,有时会收到非常奇怪的错误消息: 2019-02-15 16:31:42,742 ERROR[pool-9-thread-1] org.apache.kafka.clients.consumer.internals.ConsumerCoordinator - [Consumer clientId=ClientVerticle_Thread[pool-9-thread-1,5,main], groupId=mygroupid] Offset commit failed on partition MYYOPIC-5 at offset 0: The request timed out.', u'[Consumer clientId=ClinetVerticle_Thread[pool-9-thread-1,5,main], groupId=mygroupid] Offset commit failed on partition MYTOPIC-5 at offset 0: The request timed out 有关设置的一些数据会重现此错误:

  • 启用了自动提交
  • 仅当offset为0(没有消息访问分区)时,才会发生此错误
  • 仅当主题附加了多个消费者组(在这种情况下为2个不同的消费者组)时,才会发生此错误
  • 主题分区数为:6
  • (每个消费者组)消费者线程数为:3
  • 消费者设置:

    config.put("client.id", InetAddress.getLocalHost().getHostAddress() + "_" + clientId + "_" + Thread.currentThread());
                    config.put("group.id", consumerGroupName);
                    config.put("bootstrap.servers", clusterUrl);
                    config.put("auto.offset.reset", "latest");
                    config.put("heartbeat.interval.ms", 3000);
                    config.put("session.timeout.ms", 10000);
                    config.put("request.timeout.ms", 10000 + 3000);
                    config.put("enable.auto.commit", true);
                    config.put("auto.commit.interval.ms", 2000);
                    config.put("key.deserializer", StringDeserializer.class.getName());
                    config.put("value.deserializer", StringDeserializer.class.getName());
                    config.put("fetch.min.bytes", 1);
                    config.put("max.partition.fetch.bytes", 1048576);
                    config.put("fetch.max.wait.ms", 500);

谢谢

0 个答案:

没有答案