Burrow 使用记录

一、Burrow介绍

Burrow是linkedin开源的一个监控Apache Kafka的工具,burrow可以将消费者滞后检查作为一项服务来对外提供。 它监视所有消费者的承诺偏移量,并根据需要计算消费者的状态,提供HTTP endpoint接口来获取消费者状态,能够监控Consumer消费消息的延迟,从而监控应用的健康状况,并且可以同时监控多个Kafka集群。 通知器可以通过配置电子邮件或HTTP通告进行告警,而无需指定阈值。

Burrow的模块:Burrow采用模块化的设计,将所需要的工作分成多个子系统模块。
1、Clusters: clusters运行一个kafka client,client 定期的更新topic 列表以及topic每个partition的 head offset。
2、Consumers: consumers 从存储库里获取consumer group 的相关信息(根据kafka版本的不同,获取的位置不同,可能是zk 、kafka的__consumer_offsets topic 等
)。
3、Storage:storage 负责存储Burrow系统的所有数据内容。
4、Evaluator:evaluator接收storage里的kafka 消费组的数据并计算出kafka consumer group的状态。
5、Notifier:Notifier 通过配置的间隔时间,定期的获取consumer group的状态,并发送相关满足配置的消息提醒。
6、HTTP Server:此模块提供了获取consumer gropu 信息的接口。

二、安装和配置:

Burrow使用GO语言编写,可以下载源码编译打包。也可以直接下载编译完成的安装包,地址为:https://github.com/linkedin/B... 下载完成后,解压 tar –xzvf *.tar.gz 。
1、配置

解压完成进入config 目录,修改burrow.toml 配置文件,我们的配置文件内容为:
[general]
pidfile="burrow.pid"
stdout-logfile="burrow.out"
access-control-allow-origin="mysite.example.com"

[logging]
filename="logs/burrow.log"
level="info"
maxsize=100
maxbackups=30
maxage=10
use-localtime=false
use-compression=true

[zookeeper]
servers=[ "10.102.*.*:2181","10.102.*.*:2181","10.102.*.*: 2181" ]
timeout=6
root-path="/burrow"

[client-profile.financial]
client-id="burrow"
kafka-version="1.1.0"

[cluster.financial]
class-name="kafka"
servers=[ "10.102.*.*:9092","10.102.*.*:9092" ]
topic-refresh=120
offset-refresh=30

[consumer.financial]
class-name="kafka"
cluster="financial"
servers=[ "10.102.*.*:9092","10.102.*.*:9092" ]
client-profile="financial"
group-blacklist="^(console-consumer-|python-kafka-consumer-|quick-).*$"
group-whitelist=""

[consumer.financiali_zk]
class-name="kafka_zk"
cluster="financial"
servers=[ "10.102.*.*:2181","10.102.*.*:2181" ]


[httpserver.default]
address=":8004"

[storage.default]
class-name="inmemory"
workers=20
intervals=15
expire-group=604800
min-distance=1

[evaluator.mystorage]
class-name="caching"
expire-cache=10

[notifier.default]
class-name="http"
url-open="http://10.103.*.*:8006/test/api"
url-close="http://10.103.*.*:8006/test/api"
interval=60
timeout=5
keepalive=30
extras={ api_key="REDACTED", app="burrow", tier="STG", fabric="mydc" }
template-open="config/default-http-post.tmpl"
template-close="config/default-http-delete.tmpl"
method-close="DELETE"
send-close=true
threshold=2
请输入代码

2、启动
配置完成后,输入命令启动:./burrow --config-dir ./config &

3、接收通知

notifier.default 的配置中,class-name 为http,提供一个接受notice的接口:接口格式大概为:

@RequestMapping("/api")
@ResponseBody
public String event(@RequestBody String json){
    ........
    return "success";
}

三、附录

burrow http 模块提供的接口

request method url format
Healthcheck GET /burrow/admin
List Clusters GET /v3/kafka
Kafka Cluster Detail GET /v3/kafka/(cluster)
List Consumers GET /v3/kafka/(cluster)/consumer
List Cluster Topics GET /v3/kafka/(cluster)/topic
Get Consumer Detail GET /v3/kafka/(cluster)/consumer/(group)
Consumer Group Status GET /v3/kafka/(cluster)/consumer/(group)/status /v3/kafka/(cluster)/consumer/(group)/lag
Remove Consumer Group DELETE /v3/kafka/(cluster)/consumer/(group)
Get Topic Detail GET /v3/kafka/(cluster)/topic/(topic)
Get General Config GET /v3/config
List Cluster Modules GET /v3/config/cluster
Get Cluster Module Config GET /v3/config/cluster/(name)
List Consumer Modules GET /v3/config/consumer
Get Consumer Module Config GET /v3/config/consumer/(name)
List Notifier Modules GET /v3/config/notifier
Get Notifier Module Config GET /v3/config/notifier/(name)
List Evaluator Modules GET /v3/config/evaluator
Get Evaluator Module Config GET /v3/config/evaluator/(name)
List Storage Modules GET /v3/config/storage
Get Storage Module Config GET /v3/config/storage/(name)
Get Log Level GET /v3/admin/loglevel
Set Log Level POST /v3/admin/loglevel

你可能感兴趣的:(kafka)