Kafka Consumer Lag 排查與 Offset 復原實戰
在 Kafka 集群環境下,先匯出原始 Offset,再以 dry-run 與 from-file 控制重置及回退;前提是 Consumer Group 狀態為 Empty 或 Dead。成功復原須同時通過各 Partition Offset 一致、Lag 趨勢符合目標、無異常錯誤日誌與業務指標正常等四項判準。
在 Kafka 集群環境下,先匯出原始 Offset,再以 dry-run 與 from-file 控制重置及回退;前提是 Consumer Group 狀態為 Empty 或 Dead。成功復原須同時通過各 Partition Offset 一致、Lag 趨勢符合目標、無異常錯誤日誌與業務指標正常等四項判準。
When Consumer Lag accumulates in a Kafka cluster, first export the original offsets, then use dry runs and `–from-file` to control resets and rollbacks; the Consumer Group must be `Empty` or `Dead`. Recovery succeeds only when offsets match across all Partitions, the Lag trend meets the objective, no abnormal errors appear in logs, and business metrics are normal.