1.概述
Kafka Eagle 用于监控 Kafka 集群中 Topic 被消费的情况。包含 Lag 的产生,Offset 的变动,Partition 的分布,Owner ,Topic 被创建的时间和修改的时间等信息。本文安装的版本是Kafka Eagle 1.1.4(之前试用了一下kafka-offset-monitor 好久没更新了),下载地址如下所示:
2.解压 Kafka Eagle
解压下载的压缩包,如下图所示:
tar -zxvf kafka-eagle-${version}-bin.tar.gz
如果你安装了之前的版本,删除或重命名,如下图所示:
rm -rf kafka-eagle
mv kafka-eagle-${version} kafka-eagle
3.配置 Kafka Eagle profile
vi /etc/profile
export KE_HOME=/data/soft/new/kafka-eagle
export PATH=$PATH:$KE_HOME/bin
或者可以把相关信息写在启动/bin/start.sh之前
4.配置文件列表
cd ${KE_HOME}/conf
您将看到以下配置文件,如下图所示:
您必须编辑 jdbc.properties
和 system-config.properties
5.配置 MySQL
创建ke数据库或用已有的库,然后需要将文件夹下的sql/ke.sql导入到数据库中
cd ${KE_HOME}/conf
vi jdbc.properties
kafka.eagle.driver=com.mysql.jdbc.Driver
kafka.eagle.url=jdbc:mysql://127.0.0.1:3306/ke?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
kafka.eagle.username=root
kafka.eagle.password=smartloli
6.配置 Zookeeper
cd ${KE_HOME}/conf
vi system-config.properties
# multi zookeeper&kafka cluster list -- The client connection address of the Zookeeper cluster is set here
kafka.eagle.zk.cluster.alias=cluster1,cluster2
cluster1.zk.list=tdn1:2181,tdn2:2181,tdn3:2181
cluster2.zk.list=xdn1:2181,xdn2:2181,xdn3:2181
# zk limit -- Zookeeper cluster allows the number of clients to connect to
kafka.zk.limit.size=25
# kafka eagel webui port -- WebConsole port access address
kafka.eagel.webui.port=8048
# kafka offset storage -- Offset stored in a Kafka cluster, if stored in the zookeeper, you can not use this option
kafka.eagle.offset.storage=kafka
# delete kafka topic token -- Set to delete the topic token, so that administrators can have the right to delete
kafka.eagle.topic.token=keadmin
7.启动 Kafka Eagle
cd ${KE_HOME}/bin
chmod +x ke.sh
./ke.sh start
启动后,我们通过在浏览器中输入 http://host:port/ke(http://localhost:8048/ke/),访问 Kafka Eagle 的 Dashboard 页面。该页面包含以下内容:
- Brokers
- Topics
- Zookeepers
- Consumers
- Kafka Brokers Graph
展示 Kafka 集群的 Topic 数量,消费者数量,Kafka 的 Brokers 数,以及所属的 Zookeeper 集群信息。Dashboard 信息展示截图如下:
通过创建模块可以创建一个自定义分区和备份数的 Topic。如下图所示:
List模块下列出 Kafka 集群中所有的 Topic,包含 Topic 的分区数,创建时间以及修改时间,如下图所示:
上图中,每一个 Topic 名称对应一个详情的超链接,通过该链接可以查看该 Topic 的详情,如:分区索引号,Leader,Replicas 和 Isr,如下图所示所示:
其他的大家自己研究吧,Kafka Eagle 的安装使用还是简单的,安装部署文档地址如下: