Deleting a Consumer Group
You can use Kafka CLI to delete a consumer group.
Using the CLI to Delete a Consumer Group
The following uses Linux as an example.
- Download Kafka CLI v1.1.0, v2.7, or v2.3.0. Ensure that the Kafka instance and the CLI are of the same version.
- Use the CLI to connect to the Kafka instance. For details, see Accessing a Kafka Instance Without SASL or Accessing a Kafka Instance with SASL.
- Run the following command to delete a consumer group:
kafka-consumer-groups.sh --bootstrap-server {Kafka instance connection address} --delete --group {consumer group name}
[root@zk-server-1 bin]# ./kafka-consumer-groups.sh --bootstrap-server 192.168.1.245:9091,192.168.1.86:9091,192.168.1.128:9091 --delete --group bbbb Note: This will not show information about old Zookeeper-based consumers. Deletion of requested consumer groups ('bbbb') was successful.
To query consumer group information, run the following commands:
- Querying the list of consumer groups:
kafka-consumer-groups.sh --bootstrap-server {Kafka instance connection address} --list
[root@zk-server-1 bin]# ./kafka-consumer-groups.sh --bootstrap-server 192.168.1.245:9091,192.168.1.86:9091,192.168.1.128:9091 --list Note: This will not show information about old Zookeeper-based consumers. KMOffsetCache-zk-server-1 bbbb KMOffsetCache-zk-server-0
- Querying the details of a consumer group:
kafka-consumer-groups.sh --bootstrap-server {Kafka instance connection address} --describe --group {consumer group name}
[root@zk-server-1 bin]# ./kafka-consumer-groups.sh --bootstrap-server 192.168.1.245:9091,192.168.1.86:9091,192.168.1.128:9091 --describe --group bbbb Note: This will not show information about old Zookeeper-based consumers. Consumer group 'bbbb' has no active members. TOPIC PARTITION CURRENT-OFFSET LOG-END-OFFSET LAG CONSUMER-ID HOST CLIENT-ID test 1 336 336 0 - - - test 0 334 334 0 - - - test 2 334 334 0 - - -
If SASL authentication is enabled for the Kafka instance, the --command-config {consumer.properties file with SASL authentication} parameter must be added to the preceding commands. For details about the consumer.properties file, see Accessing a Kafka Instance with SASL.
- Querying the list of consumer groups:
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot