当系统处于空闲状态并且启用了自动提交偏移量时,有时会收到非常奇怪的错误消息:
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
有关设置的一些数据会重现此错误:
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);
谢谢