获取Kafka使用情况详细信息 [英] Getting Kafka usage details
问题描述
我正在尝试找到获取我的kafka集群当前使用情况统计信息的方法.我希望收集以下信息:
I am trying to find ways to get current usage statistics for my kafka cluster. I am looking to collect following information:
- kafka集群中的主题数
- 每个kafka经纪人的分区数
- 活跃的消费者和生产者的数量
- 每个kafka代理的客户端连接数
- 每个分区上的消息数,磁盘大小等.
- 复制品滞后,消费者滞后等.
- 活跃的消费群体
可以并且应该收集的任何其他统计信息,目前我正在收集上述统计信息.
Any other statistics that can and should be collected, currently I am looking at collecting the above stats.
我可以使用Zookeeper实用程序获得1和2,但是我迷失了休息.我已经在Jconsole中查看了mbean,但是上面没有发现任何东西.我还尝试了JmxTool使用基于正则表达式的表达式来获取这些mbean,但这还是行不通的.
I can get 1 and 2 using zookeeper utilities but I am lost on rest. I have looked at mbeans in Jconsole but didn't find anything about above. I also tried JmxTool to get these mbeans using regex based expression but that also didn't work.
我正在使用Kafka v2.1并使用新的消费者api,所以zookeeper没有关于消费者的任何信息.
I am using Kafka v2.1 and using new consumer api so zookeeper doesn't have any information about consumers.
任何指针都会有很大帮助!
Any pointers would be great help!
推荐答案
还可以使用 https://github.com/yahoo/kafka-manager 或 https://github.com/linkedin /cruise-control 获取此信息.
Might as well use https://github.com/yahoo/kafka-manager or https://github.com/linkedin/cruise-control to get this information.
$ KAFKA_HOME/bin下有一些脚本可以帮助您.
There are scripts under $KAFKA_HOME/bin which can help you.
kafka集群中的主题数
Number of topics in kafka cluster
./kafka-topics.sh --zookeeper本地主机:2181-列表
./kafka-topics.sh --zookeeper localhost:2181 --list
每个kafka代理的分区数
Number of partitions per kafka broker
./kafka-topics.sh --zookeeper本地主机:2181-描述
./kafka-topics.sh --zookeeper localhost:2181 --describe
每个分区上的消息数,磁盘大小等
Number of messages on each partition, size of disk etc.
./kafka-log-dirs.sh --describe --bootstrap-server localhost:9092
./kafka-log-dirs.sh --describe --bootstrap-server localhost:9092
复制品滞后,消费者滞后等.
Lagging replicas, consumer lag etc.
./kafka-consumer-group.sh --bootstrap-server localhost:9092 --group $ GROUP_NAME --describe
./kafka-consumer-group.sh --bootstrap-server localhost:9092 --group $GROUP_NAME --describe
活跃的消费群体 活跃的消费者和生产者数量
Active consumer groups Number of active consumers and producers
您无法成为活跃的制作人. 了解kafka主题的现有生产者
You can't get active producer. Know existing producers for a kafka topic
./kafka-consumer-group.sh --bootstrap-server localhost:9092 --list
./kafka-consumer-group.sh --bootstrap-server localhost:9092 --list
每个kafka代理的客户端连接数
Number of client connections per kafka broker
./
这篇关于获取Kafka使用情况详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!