Kafka 0.11 如何重置偏移量 [英] Kafka 0.11 how to reset offsets
问题描述
我正在尝试使用适用于 Kafka 的最新 CLI 工具重置消费者偏移量.
I'm trying to reset consumer offset with latest CLI tools for Kafka.
kafka-consumer-groups.bat --bootstrap-server kafka-host:9092 --group my-group --reset-offsets --to-earliest --all-topics
结果我看到了这个输出:
As a result I see this output:
TOPIC PARTITION NEW-OFFSET
FirstTopic 0 0
SecondTopic 0 0
但是再次运行命令:
kafka-consumer-groups.bat --bootstrap-server kafka-host:9092 --group my-group --describe
结果输出:
Consumer group 'my-group' has no active members.
TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG
FirstTopic 0 1230 1230 0
SecondTopic 0 1022 1022 0
我尝试了其他选项,例如重置为显式偏移或直接指定主题,但结果相同.输出提示操作成功,同时使用describe 命令检查偏移量或调试显示偏移量未更改.
I've tried other options like resetting to explicit offset or specifying the topic directly but result is same. The output suggests that operation succeed while checking offsets with describe command or debugging shows that offset has not be changed.
任何人都可以在非 Zookeeper 代理中成功重置消费者偏移量.
Anyone succeed with resetting consumer offset within non-zookeeper brokers.
推荐答案
默认情况下,--reset-offsets
只是打印操作的结果.要实际执行操作,您需要将 --execute
添加到您的命令中:
By default, --reset-offsets
just prints the result of the operation. To actually perform the operation you need to add --execute
to your command:
kafka-consumer-groups.bat --bootstrap-server kafka-host:9092 --group
my-group --reset-offsets --to-earliest --all-topics --execute
这篇关于Kafka 0.11 如何重置偏移量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!