返回到文章

采纳

编辑于 3年前

删除kafka消费者组

kafka
kafka
笔记

你可以通过使用Kafka客户端的Kafka命令行工具从Kafka实例中删除消费者组。

查询消费者组列表:

kafka-consumer-groups.sh --bootstrap-server 172.31.1.245:9092 --list

查询消费者组明细:

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 172.31.1.245:9091,172.31.1.86:9091,172.31.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               -

删除消费者组:

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 172.31.1.245:9091,172.31.1.86:9091,172.31.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.