简体   繁体   English

从 kafka 主题 __consumer_offsets 中删除特定消息

[英]delete specific messages from kafka topic __consumer_offsets

I want to delete all messages that are contained in the __consumer_offsets table that start with a given key (resetting one particular consumer group without affecting the rest).我想删除__consumer_offsets表中包含的所有以给定键开头的消息(重置一个特定的消费者组而不影响其余的)。

Is there a way to do this?有没有办法做到这一点?

Kafka comes with a ConsumerGroupCommand tool. Kafka 附带了一个 ConsumerGroupCommand 工具。 You cand find some information in the Kafka documentation .您可以在 Kafka 文档中找到一些信息。

If you plan to reset a particular Consumer Group ("myConsumerGroup") without affecting the rest you can use如果您计划重置特定的消费者组(“myConsumerGroup”)而不影响其余的,您可以使用

> bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --reset-offsets --group myConsumerGroup --topic topic1 --to-latest

Depending on your requirement you can reset the offsets for each partition of the topic with that tool.根据您的要求,您可以使用该工具重置主题的每个分区的偏移量。 The help function or documentation explain the options.帮助功能或文档解释了这些选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM