我想按时间戳重置kafka用户组的偏移量。
但是当我使用以下命令时:

./kafka-consumer-groups.sh --bootstrap-server localhost:9092 --reset-offsets --to-datetime 2017-11-1907:52:43:00:000 --group <group_name> --topic <topic_name> --execute


我收到以下错误消息:


注意:这只会显示有关使用
Java使用者API(非基于ZooKeeper的使用者)。


如何根据时间重置偏移量

最佳答案

调用中

bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092
--group test-group --reset-offsets --all-topics --to-datetime 2017-08-04T00:00:00.000


可以在给定日期时间之后将偏移量重置为最早的偏移量。日期时间格式为yyyy-MM-ddTHH:mm:ss.xxx,例如2017-08-04T00:00:00.000。

您还可以按时长重置偏移量。请参阅以下示例:

bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092
--group test-group --reset-offsets --all-topics --by-duration PT0H30M0S


--by-duration将偏移量重置为从当前时间戳记的持续时间偏移量。格式:“ PnDTnHnMnS”。

关于apache-kafka - 卡夫卡0.11重置消费组的偏移量--to-datetime,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47391586/

10-12 23:46