在 Kafka 中,如何找到给定开始日期和结束日期(或说时间戳)之间所有分区的偏移量并重播消息

In Kafka, how to find the offsets for all partitions between given start and end date (or say timestamp) and replay the msgs

我需要找到给定开始日期和结束日期之间的所有偏移量,然后重播此时间段的消息丢失。

您可以使用 kafka-consumer-groups 工具重置消费者组的偏移量 - https://docs.cloudera.com/runtime/7.2.1/kafka-managing/topics/kafka-manage-cli-cgroups.html(这来自 cloudera,但包含在 v0.11 的任何 kafka 发行版中)

您还可以运行以下内容: ./kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list <hostname>:<port> --time <epoch> --topic <topic> 并按时间偏移。 参考https://cwiki.apache.org/confluence/display/KAFKA/System+Tools#SystemTools-GetOffsetShell