简体   繁体   English

来自 jmx 指标的 kafka 消费者滞后与消费者组.sh 脚本

[英]kafka consumer lag from jmx metrics vs consumer-groups.sh script

I am in the process of setting up monitoring for kafka consumers and brokers.我正在为 kafka 消费者和经纪人设置监控。 Monitoring the server metrics seems fairly trivial but I am confused with the kafka consumer metrics specifically lag.监控服务器指标似乎相当简单,但我对 kafka 消费者指标特别滞后感到困惑。

I initially obtained the consumer lag on a topic per partition running the consumer-groups.sh describe group script programmatically.我最初以编程方式运行 consumer-groups.sh 描述组脚本的每个分区获得了消费者滞后。 There is also the consumer_offsets topic which I believe reveals the lag as well.还有一个consumer_offsets主题,我相信它也揭示了滞后。 But I was informed this lag value is not accurate and I should be obtaining it via jmx metrics on the consumer host.但是我被告知这个滞后值不准确,我应该通过消费者主机上的 jmx 指标获取它。 Can someone verify if this is correct and why?有人可以验证这是否正确,为什么? Basically I want to know which would be the most reliable means to find the correct lag for a consumer.基本上我想知道哪种方法是为消费者找到正确滞后的最可靠方法。

This is what I am told I should be retrieving: kafka.consumer:type=consumer-fetch-manager-metrics,client-id={client-id} Attribute: records-lag-max这就是我被告知我应该检索的内容:kafka.consumer:type=consumer-fetch-manager-metrics,client-id={client-id} 属性:records-lag-max

The problem is that not sure how to access the consumer client server if not given the port or is there a default port for this?问题是如果没有给定端口或者是否有默认端口,不确定如何访问消费者客户端服务器? Also do all kafka consumer clients register jmx metrics?是否所有 kafka 消费者客户端都注册 jmx 指标?

Thanks谢谢

Well, not all consumers will be Java clients, but for those that are, the JMX Metrics exposed there would be the most immediately updated, as the conusmer knows what data is consumed and when.好吧,并非所有消费者都是 Java 客户端,但对于那些是 Java 客户端的客户端,公开的 JMX 指标将是最即时更新的,因为消费者知道什么数据被消费以及何时被消费。 And offsets consumed can be blocking synchrous or asynchronous, and only then would end up in the offsets topic.消耗的偏移量可能会阻塞同步或异步,只有这样才会在偏移量主题中结束。

But if you do want to monitor all consumer groups of all clients, you can use the offsets topic and tools like LinkedIn's Burrow to easily get a REST API over that information.但是,如果您确实想监控所有客户的所有消费者群体,您可以使用偏移主题和 LinkedIn 的 Burrow 之类的工具轻松获取有关该信息的 REST API。 Telegraf also has a plugin for exporting that data into a metric store Telegraf 还有一个插件,用于将数据导出到指标存储中

how to access the consumer client server if not given the port or is there a default port for this如果没有给定端口或是否有默认端口,如何访问消费者客户端服务器

You would enable the JMX on the Java clients the same as the servers, and other JVM processes.您可以在 Java 客户端和服务器以及其他 JVM 进程上启用 JMX。 The port is something you would choose港口是你会选择的东西

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

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