Kafka Error获取偏移数据。原因:1

时间:2015-06-19 04:04:08

标签: java offset runtimeexception kafka-consumer-api apache-kafka

我正在运行一个使用kafka库的java程序,每隔1秒检查一次来自zookeeper的使用者组的已提交偏移量。 该程序运行良好约2小时,并开始抛出RuntimeException:

listener = threading.Thread(target=kbdListener)
listener.start()

...

1是什么原因?我找不到任何说明这种情况根本原因的文件或页面。

1 个答案:

答案 0 :(得分:3)

检查一下,这是kafka.common.ErrorMapping的代码片段:

  val UnknownCode : Short = -1
  val NoError : Short = 0
  val OffsetOutOfRangeCode : Short = 1
  val InvalidMessageCode : Short = 2
  val UnknownTopicOrPartitionCode : Short = 3
  val InvalidFetchSizeCode  : Short = 4
  val LeaderNotAvailableCode : Short = 5
  val NotLeaderForPartitionCode : Short = 6
  val RequestTimedOutCode: Short = 7
  val BrokerNotAvailableCode: Short = 8
  val ReplicaNotAvailableCode: Short = 9
  val MessageSizeTooLargeCode: Short = 10
  val StaleControllerEpochCode: Short = 11
  val OffsetMetadataTooLargeCode: Short = 12
  val StaleLeaderEpochCode: Short = 13
  val OffsetsLoadInProgressCode: Short = 14
  val ConsumerCoordinatorNotAvailableCode: Short = 15
  val NotCoordinatorForConsumerCode: Short = 16
  val InvalidTopicCode : Short = 17
  val MessageSetSizeTooLargeCode: Short = 18
  val NotEnoughReplicasCode : Short = 19
  val NotEnoughReplicasAfterAppendCode: Short = 20

如您所见,1表示OffsetOutOfRangeCode