Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete kafka consumer group (created via new consumer api)?

I have created kafka consumers via new consumer API
I am using kafka 2.10-0.9.0.1
We have 1 consumer group with 1 consumer instance in each group

Kafka script 'kafka-consumer-groups.sh' provides way to delete user but that is applicable only for old consumer groups Running command :

bin/kafka-consumer-groups.sh

Gives

--delete : WARNING: Group deletion only works for old ZK-based consumer groups, and one has to use it carefully to only delete groups that are not active.

So I want to ask is there any way to delete consumer group created via new consumer API ?

like image 596
nikhil7610 Avatar asked Jun 10 '16 07:06

nikhil7610


1 Answers

There is no need to delete with the new consumer. Here is what the script outputs when attempting to delete:

Note that there's no need to delete group metadata for the new consumer as it is automatically deleted when the last member leaves

That's the short answer. More details: By "metadata", two things are meant. First, just the information about the consumers and consumer groups that is stored as part of the group membership coordinator. That is automatically removed if all consumers in the group are gone.

Second, the consumer group has stored the committed offsets in a Kafka topic (when the new consumer is used. Previously these used to be stored with Zookeeper). That topic is not immediately deleted when the consumer group disappears. If the consumer group reappears again, it will find the previous offsets automatically in this topic. It can choose to use them or ignore them. If the consumer group never reappears, these stored offsets are eventually garbage collected automatically.

So in a nutshell, there is no need to delete anything when using the new consumer.

like image 176
Eno Thereska Avatar answered Sep 26 '22 16:09

Eno Thereska