保留期后的卡夫卡偏移 [英] Kafka Offset after retention period

查看:22
本文介绍了保留期后的卡夫卡偏移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有 1 个分区的 kafka 主题.如果其中有 100 条消息,则偏移量将从 0.99 开始.

I have a kafka topic with 1 partition. if it had 100 messages in it the offset would be from 0.99.

根据 kafka 保留政策,所有消息将在指定时间段后被清除.

According the kafka retention policy all of the messages will be wiped out after the specified period.

一旦所有消息都被清除(保留期后),我将向该主题发送 100 条新消息.现在,消息的新偏移量从哪里开始?是从 100 开始还是从 0 开始??

and i am sending 100 new messages to the topic once all have been wiped out(after retention period). Now, where would the new offset of the message start from? is it From 100 or from 0??

我想了解新的偏移量是 100-199 还是 0-99?

I am trying to understand whether the new offsets will be 100-199 or 0-99?

推荐答案

Kafka 通过删除满足谓词的日志段来遵守日志保留策略,并且永远不会删除活动日志段,即活动日志的基偏移量段将始终保留.

Kafka honors the log retention policy by deleting log segments which satisfy the predicate and it will not never remove the active log segment which means the base offset of the active log segment will always be kept.

就你的例子而言,如果第一批 100 条消息都在同一个日志段中,Kafka 将创建一个基偏移为 100 的新日志段,并在日志保留期为 100 之后删除旧段时间飞逝.所以一条新消息从 100 开始偏移.

As for your example, if the first batch of 100 messages are all in a same log segment, Kafka will create a new log segment with the base offset of 100 and delete the old segment after a log-retention-period amount of time passed. So a new message starts offset at 100.

这篇关于保留期后的卡夫卡偏移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆