简体   繁体   English

kafka(非活动)消费者滞后监控

[英]kafka (inactive) consumer lag monitoring

I using Confluent Kafka 0.10.0 . 我使用Confluent Kafka 0.10.0 I want to monitor consumer offset(s) for purposes of alerting. 我想监视消费者偏移量以进行警报。

Where are the values for a Consumer Group stored when the group isn't active? 消费者组处于非活动状态时,其值存储在哪里? Is there a programmatic method to extract these? 有没有编程的方法来提取这些? (IE something in the kafka api) (即kafka api中的某些内容)

Similarly - is there a way to get a list of groups that includes the inactive ones? 同样-是否有一种方法可以获取包含不活动组的组列表?


Note: 注意:

The only way to (presently) list / describe the groups for my project is to use (目前)列出/描述我的项目组的唯一方法是使用
kafka-consumer-groups ... --new-consumer . kafka-consumer-groups ... --new-consumer

Do the following things: 请执行以下操作:

  1. Get your group.id, and calculate Math.abs(groupID.hashCode()) % 50. Say your group.id is "test_group1", then get the target partition number by calculating Math.abs("test_group1".hashCode()) % 50 获取您的group.id,并计算Math.abs(groupID.hashCode())%50。假设您的group.id为“ test_group1”,然后通过计算Math.abs(“ test_group1” .hashCode()获得目标分区号)%50
  2. Run the command below using the target partition number calculated previously: 使用先前计算的目标分区号运行以下命令:

    bin/kafka-simple-consumer-shell.sh --topic __consumer_offsets --partition --broker-list *** --formatter "kafka.coordinator.GroupMetadataManager\\$OffsetsMessageFormatter" bin / kafka-simple-consumer-shell.sh --topic __consumer_offsets --partition --broker-list *** --formatter“ kafka.coordinator.GroupMetadataManager \\ $ OffsetsMessageFormatter”

You should be able to see the offsets for this inactive group. 您应该能够看到此非活动组的偏移量。 For active groups, just running kafka-consumer-groups script is enough. 对于活动组,仅运行kafka-consumer-groups脚本就足够了。

Have a look at the kafka documentation. 看看kafka文档。 The following page claims to be a working example of just what you want: https://cwiki.apache.org/confluence/display/KAFKA/Committing+and+fetching+consumer+offsets+in+Kafka 以下页面声称是您想要的工作示例: https : //cwiki.apache.org/confluence/display/KAFKA/Committing+and+fetching+consumer+offsets+in+Kafka

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

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