kafka 计算 offset 和 lag

consumer-offset.sh

#!/bin/bash
cd /opt/kafka_2.12-2.4.1
while [ true ]; do
/bin/sleep 1
./bin/kafka-consumer-groups.sh --describe --bootstrap-server localhost:9092  --group test-in6-1-group |sed '1,2d'|
awk '{cf +=$4;pf +=$5;lag +=$6};END {print "consumer offset is",cf,"; producer offset is",pf,"; lag is",lag}' >> /tmp/test-consumer-offset.log
done
#!/bin/bash
echo $(date +%F%n%T)
/opt/kafka_2.12-2.4.1/bin/kafka-consumer-groups.sh --describe --bootstrap-server localhost:9092  --group test-in6-1-group |sed '1,2d'|
awk '{cf +=$4;pf +=$5;lag +=$6};END {print "consumer offset is",cf,"; producer offset is",pf,"; lag is",lag}'

 

上一篇:java~并行计算~大集合的并行处理


下一篇:kafka知识点