Query kafka information consumption on the command line

1. Find the installation directory where kafka is located

find  /  -name kafka

2. List which user groups are consuming:

./kafka-consumer-groups.sh --bootstrap-server 192.168.100.77:29092 --list

#bootstrap-server Install the server address of kafka
3. Check the kafka message consumption of a certain user group and see if there is any data backlog

./kafka-consumer-groups.sh --bootstrap-server 192.168.100.77:9092 --describe --group groupname

#可用第二条命令查询用户组的ID
#执行后的效果
 
TOPIC                 PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG             CONSUMER-ID     HOST            CLIENT-ID
这是你的topic消息队列id 0          138             189             51              -               -               -
 
 
# CURRENT-OFFSET  这是当前已经消费了的偏移量
 
# LAG  这是消息积压数量

groupname is one of the results of the first step of query


4. Check the maximum value of the data offset (offset) of a certain partition of the topic, which is to see how many messages are currently in Kafka.

./kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list 192.168.100.77:9092 --topic globalLog-test --partitions 0


###结果
globalLog-test:0:338828


 

Guess you like

Origin blog.csdn.net/wangguoqing_it/article/details/127388215