我试图重置Kafka偏移,但无法重置它。
当前偏移量为6,尝试将其重置为最早的偏移量,并尝试将其减小1,但它未重置并继续反射6
kafka-consumer-groups --bootstrap-server <server>:9092 --group EDWOFFSETGROUP_24 --describe
Consumer group 'EDWOFFSETGROUP_24' has no active members.
TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG CONSUMER-ID HOST CLIENT-ID
EDW_TOTALS_JSON1 0 6 6 0 - - -
接近1
kafka-consumer-groups --bootstrap-server <server>:9092 --group EDWOFFSETGROUP_24 --topic EDW_TOTALS_JSON1:0 --reset-offsets --shift-by -1
WARN: No action will be performed as the --execute option is missing.In a future major release, the default behavior of this command will be to prompt the user before executing the reset rather than doing a dry run. You should add the --dry-run option explicitly if you are scripting this command and want to keep the current default behavior without prompting.
[2019-12-04 14:43:14,364] WARN New offset (5) is lower than earliest offset for topic partition EDW_TOTALS_JSON1-0. Value will be set to 6 (kafka.admin.ConsumerGroupCommand$)
TOPIC PARTITION NEW-OFFSET
EDW_TOTALS_JSON1 0 6
进近#2
kafka-consumer-groups --bootstrap-server <server>:9092 --group EDWOFFSETGROUP_24 --topic EDW_TOTALS_JSON1 --reset-offsets --to-earliest --execute
TOPIC PARTITION NEW-OFFSET
EDW_TOTALS_JSON1 0 6
1条答案
按热度按时间gupuwyp21#
似乎通过传递保留策略清除了数据。如果消息被截断,它将从主题分区细节上出现的新位置开始。
请参阅保留设置定义
您可以尝试与新消费者进行验证
如果您正在使用新的api,请使用下面的
您还可以使用getoffsetshell检查分区的偏移详细信息
例子