如何从特定主题中删除 Kafka 消费者组? [英] How to remove a Kafka consumer group from a specific topic?
问题描述
我更改了监听 Kafka 主题的 Web 服务的消费者组 ID.现在,旧的组 ID 仍然注册到主题,但没有具有该组 ID 的消费者.因此,它是滞后的.如何从特定主题中删除特定的消费者群体?
I changed the consumer-group-id of my web service listening to a Kafka topic. Now, the old group id is still registered to the topic, but there is no consumer with that group id. Therefore, it is lagging. How can I remove a specific consumer group from a specific topic?
我试过了:
kafka-consumer-groups --bootstrap-server kafka01.myserver.com:9092 --topic notification-topic --delete --group old-consumer-group --execute
但它返回:消费者不支持从消费者组中删除特定于主题的偏移量."
我应该完全删除消费者组吗?我用同一个群号听别的话题,会不会受影响?
Should I remove the consumer group totally? I use the same group id listening to other topics, are they going to be affected?
推荐答案
从 Kafka 2.4.0 开始,可以从主题中删除单个消费者组 ID 偏移量.
Starting with Kafka 2.4.0 it is possible to delete individual consumer group id offsets from a topic.
调用与您已经尝试过的非常接近,但需要 --delete-offsets
而不是 --delete
:
The call is very close to what you have already tried, but requires --delete-offsets
instead of --delete
:
./kafka-consumer-groups.sh \
--bootstrap-server <bootstrap-server-url> \
--delete-offsets \
--group <my-group> \
--topic <topic-name>
迄今为止,这并未反映在官方文档(Kafka 2.7.0 及以下).但是,它在改进提案的汇合文档中进行了描述 KIP-496 已实施和发布.
To date this is not reflected in the official documentation (Kafka 2.7.0 and below). However, it is described in a confluence document of improvement proposal KIP-496 that has been implemented and released.
这篇关于如何从特定主题中删除 Kafka 消费者组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!