[Kafka基础]-- auto.offset.reset介绍

本文介绍了当Kafka中没有初始偏移量或当前偏移量不再存在时的处理方式,包括自动重置到最早或最新偏移量,以及抛出异常等策略。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

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"

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

oo寻梦in记

你的鼓励将是我创作的最大动力!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值