Reputation: 12523
I have the requirement to delete some consumer groups with a specific suffix:
consumer_1_123
consumer_2_123
consumer_3_123
consumer_1_124
consumer_2_124
The command:
./kafka-consumer-groups.sh --bootstrap-server MY_BOOTSTRAP_SERVER --delete --group *_123
Fails with:
Error: Deletion of some consumer groups failed: * Group '*_123' could not be deleted due to: GROUP_ID_NOT_FOUND
I am able to delete whole topics via wildcard pattern but I am not able to delete consumer groups this way.
Is there any possibility to manage this?
Upvotes: 0
Views: 1463
Reputation: 26885
The kafka-consumer-groups
tool does not currently allow deleting groups using wildcards. It actually does not even allow managing several groups at a time and needs to be restarted for each group.
There is a KIP in progress to add support for multiple groups: https://cwiki.apache.org/confluence/display/KAFKA/KIP-379%3A+Multiple+Consumer+Group+Management I see someone asked about wildcard support in the discussion thread. Feel free to comment there if it's something you'd like to see as the KIP is still under discussion.
Currently the only option is to delete each group explicitly. If you don't know all the group names, you can use first list all groups and filter you ones you are interested in. Then delete them 1 by 1.
Note that the AdminClient API allows to delete several groups at once. Although it's again by naming them without wildcards.
Upvotes: 3