简体   繁体   English

Kafka 消费者滞后指标

[英]Kafka consumer lag metric

We are using kafka 2.12.XXXX - and need to observe how much lag consumers have on all the partitions of a topic.我们正在使用kafka 2.12.XXXX - 并且需要观察消费者在一个主题的所有分区上有多少滞后。
Is the the summation of the LAG column in ./kafka-consumer-groups.sh --describe an accurate representation of that是 ./kafka-consumer-groups.sh 中 LAG 列的./kafka-consumer-groups.sh --describe的准确表示

Yes, using the kafka-consumer-groups.sh script, you can get the consumer lag information for a given consumer group.是的,使用kafka-consumer-groups.sh脚本,您可以获得给定消费者组的消费者滞后信息。 The summation of the values under LAG column would be the total lag for that particular consumer group. LAG列下的值的总和将是该特定消费者组的总滞后。

➜  ~ sh $KAFKA_HOME/bin/kafka-consumer-groups -bootstrap-server localhost:9092 --describe --group test-group
Consumer group 'test-group' has no active members.

TOPIC                PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG             CONSUMER-ID     HOST            CLIENT-ID
test-topic           0          53              53              0               -               -               -
test-topic           1          53              53              0               -               -               -

However, I would suggest using a command line tool like kt ( source ), as it is faster and can provide you a json output, which would be easier to work with.但是,我建议使用像kt ( source ) 这样的命令行工具,因为它速度更快,并且可以为您提供 json output,这将更容易使用。

➜  ~ kt group -brokers localhost:9092 -topic test-topic -group test-group
found 1 brokers
found 1 groups
found 1 topics
found partitions=[0 1] for topic=test-topic
{
  "name": "test-group",
  "topic": "test-topic",
  "offsets": [
    {
      "partition": 0,
      "offset": 53,
      "lag": 0
    },
    {
      "partition": 1,
      "offset": 53,
      "lag": 0
    }
  ]
}

The lag key in the output is the consumer lag for every partition for the given consumer group. output 中的lag键是给定消费者组的每个分区的消费者滞后。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM