I executed
"kafka-consumer-groups --bootstrap-server localhost:9092 --list"
and this results in one group being displayed: console-consumer-961
I then tried to delete this group:
kafka-consumer-groups --bootstrap-server localhost:9092 --delete --group console-consumer-961
But this results in an exception:
Error: Deletion of some consumer groups failed:
* Group 'console-consumer-961' could not be deleted due to: java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.GroupNotEmptyException: The group is not empty.
I guess this group was created when I ran kafka-console-consumer.bat
, but now this consumer is not running. How can I delete this consumer group?
You can validate the state of a consumer group by using the kafka-consumer-groups
command line tool.
bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group console-consumer-961 --state
This will show you the state of the consumer. If it is not empty, Kafka will not allow to delete that group. If it still shows that your console consumer is running you need to make sure to properly shut it down (usually by CTRL+C)