SparkStreaming中的auto.offset.reset 参数介绍

我们先看看最新的官方文档说明:

What to do when there is no initial offset in Kafka or if the current offset does not exist any more on the server (e.g. because that data has been deleted):

  • earliest: automatically reset the offset to the earliest offset
  • latest: automatically reset the offset to the latest offset
  • none: throw exception to the consumer if no previous offset is found for the consumer's group
  • anything else: throw exception to the consumer.

翻译:

当Kafka中没有初始偏移或如果当前偏移在服务器上不再存在时(例如,因为该数据已被删除),该怎么办:

  1. 最早:自动将偏移重置为最早的偏移
  2. 最新:自动将偏移重置为最新偏移
  3. none:如果没有为消费者组找到以前的偏移,则向消费者抛出异常
  4. 任何其他:抛出异常到消费者。

“auto.offset.reset”的值只能是:[latest, earliest, none]中的一个,默认是"latest"

猜你喜欢

转载自blog.csdn.net/qq_21918145/article/details/81807450