其他分享
首页 > 其他分享> > kafka 计算 offset 和 lag

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}'

 

标签:bin,--,lag,kafka,offset,consumer
来源: https://www.cnblogs.com/tonggc1668/p/15344086.html