1. 重置消费位点
${KAFKA_HOME}/bin/kafka-consumer-groups.sh \
--bootstrap-server 127.0.0.1:9092 \
--group test_group \
--topic test_topic \
--reset-offsets \
--to-datetime 2022-10-18T12:00:00.000 \
-execute
时间戳格式一定要是"yyyy-MM-dd'T'HH:mm:ss.SSS"
执行后控制台会打印该时间戳对应的offset信息:

2. 从上述位点开始消费
${KAFKA_HOME}/bin/kafka-console-consumer.sh \
-topic test_topic \
--bootstrap-server 127.0.0.1:9092 \
--group test_group
本文介绍了如何使用kafka-consumer-groups.sh工具重置消费组的位点到特定时间,并从该时间点开始消费test_topic主题的消息,包括执行命令步骤和控制台输出的解读。
172万+

被折叠的 条评论
为什么被折叠?



