简体   繁体   English

卡卡auto.offset.reset查询

[英]Kaka auto.offset.reset query

My project uses Kafka 0.10.2 version.我的项目使用 Kafka 0.10.2 版本。 Iam setting enable.auto.commit=false and auto.offset.reset=latest in the consumer.我在消费者中设置 enable.auto.commit=false 和 auto.offset.reset=latest。 If consumer is restarted after maintenance, the consumer is reading again from first offset instead of waiting for latest offset messages.如果消费者在维护后重新启动,消费者将再次从第一个偏移量读取,而不是等待最新的偏移量消息。 Any reasons why is this happening?发生这种情况的任何原因? Have i understood the configurations wrongly?我是否错误地理解了配置?

My requirement is the consumer should not auto commit and should read only the new messages put into the topic when it is active.我的要求是消费者不应该自动提交,并且应该只读取主题处于活动状态时放入的新消息。

Just because you aren't auto committing doesn't guarnatee there are no manual commits.仅仅因为您没有自动提交并不能保证没有手动提交。

Regardless, auto.offset.reset=latest will never send the consumer group to the beginning of the topic.无论如何, auto.offset.reset=latest永远不会将消费者组发送到主题的开头。 Sounds like whatever Kafka tool / library you are using is calling a consumer.seekToBeginning call on its own.听起来您正在使用的任何 Kafka 工具/库都在自行调用consumer.seekToBeginning调用。

For Understanding purpose, The Consumer property auto.offset.reset determines what to do if there is no valid offset in Kafka for the Consumer's Consumer Group Based on the below scenarios:出于理解目的,Consumer 属性auto.offset.reset根据以下场景确定如果 Kafka 中没有针对 Consumer 的 Consumer Group 的有效偏移量时要执行的操作:

– When a particular Consumer Group starts the first time – 当特定的消费者组第一次启动时

– If the Consumer offset is less than the smallest offset – 如果Consumer offset小于最小offset

– If the Consumer offset is greater than the last offset – 如果Consumer offset大于上一个offset

▪ The value can be one of: ▪ 该值可以是以下之一:

earliest : Automatically reset the offset to the earliest available earliest :自动将偏移量重置为最早可用的

latest : Automatically reset to the latest offset available latest :自动重置为可用的最新偏移量

none : Throw an exception if no previous offset can be found for the ConsumerGroup none :如果找不到 ConsumerGroup 的先前偏移量,则抛出异常

▪ The default is latest ▪ 默认是latest

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用rest api设置kafka connect auto.offset.reset - how to set kafka connect auto.offset.reset with rest api 如果 auto.offset.reset=earliest 但主题没有消息,将设置什么消费者偏移量 - What consumer offset will be set if auto.offset.reset=earliest but topic has no messages 不清楚Kafka中auto.offset.reset和enable.auto.commit的含义 - Not clear about the meaning of auto.offset.reset and enable.auto.commit in Kafka 无论如何对kafka流应用程序中的不同输入主题使用不同的auto.offset.reset策略? - Is there anyway to use different auto.offset.reset strategy for different input topics in kafka streams app? debezium sql 服务器连接 auto.offset.reset=latest 出错 - debezium sql server connect getting error with auto.offset.reset=latest Spark Streaming 不支持 auto.offset.reset="smallest" 或 group.id? - Spark Streaming not honoring auto.offset.reset=“smallest” or group.id? 即使在将“auto.offset.reset”设置为“latest”之后也会出现错误 OffsetOutOfRangeException - Even after setting “auto.offset.reset” to “latest” getting error OffsetOutOfRangeException FlinkKafkaConsumer082 auto.offset.reset设置不起作用? - FlinkKafkaConsumer082 auto.offset.reset setting doesn't work? 即使使用 auto.offset.reset,我的 Java 消费者也无法从 Broker 读取消息 - 最早 - My Java Consumer can't read messages from Broker even with auto.offset.reset - earliest spark-streaming-kafka-0-10 auto.offset.reset 始终设置为 none - spark-streaming-kafka-0-10 auto.offset.reset is always set to none
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM