本文介绍了Kafka 0.11如何重置偏移量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用适用于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.

任何人都可以在非动物饲养员经纪人中重置消费者补偿.

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如何重置偏移量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 20:39