Kafka 2.0 ConsumerGroupCommand新功能

一直觉得kafka-consumer-groups.sh的输出信息有点少,总算在2.0中得到了改善。新版本ConsumerGroupCommand增加了查看成员信息、组状态信息,算是弥补了之前的不足。今天试用了一下,感觉还不错,推荐大家也用一用~~

1. 查看成员信息(简约版):

$:kafka_2.12-2.0.0 huxi$ bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092,localhost:9093,localhost:9094 --describe --group test-group --members

 

CONSUMER-ID                                     HOST            CLIENT-ID       #PARTITIONS     

consumer-1-aa3f2e15-d577-4c51-acd5-aa0d488cc131 /127.0.0.1      consumer-1      8               

consumer-1-f3b11334-b9eb-4d4f-80d1-766446c77ee9 /127.0.0.1      consumer-1      8               

consumer-1-658e4d7b-a561-4430-bbdf-c3ab59a18f3a /127.0.0.1      consumer-1      9 

2. 查看成员信息(详细版):

$:kafka_2.12-2.0.0 huxi$ bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092,localhost:9093,localhost:9094 --describe --group test-group --members --verbose

 

CONSUMER-ID                                     HOST            CLIENT-ID       #PARTITIONS     ASSIGNMENT

consumer-1-aa3f2e15-d577-4c51-acd5-aa0d488cc131 /127.0.0.1      consumer-1      8               test-topic(9,10,11,12,13,14,15,16)

consumer-1-f3b11334-b9eb-4d4f-80d1-766446c77ee9 /127.0.0.1      consumer-1      8               test-topic(17,18,19,20,21,22,23,24)

consumer-1-658e4d7b-a561-4430-bbdf-c3ab59a18f3a /127.0.0.1      consumer-1      9               test-topic(0,1,2,3,4,5,6,7,8)

3. 查看组状态信息:

$:kafka_2.12-2.0.0 huxi$ bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092,localhost:9093,localhost:9094 --describe --group test-group --state

 

COORDINATOR (ID)          ASSIGNMENT-STRATEGY       STATE                #MEMBERS

localhost:9092 (0)        range                     Stable               3

posted @ 2018-10-08 10:46  huxihx  阅读(3316)  评论(0编辑  收藏  举报