给kafka配一个web版的管理页面或仪表盘,管理起来更加方便
直接下载kafka-eagle-bin-2.1.0.tar.gz链接:https://codeload.github.com/smartloli/kafka-eagle-bin/tar.gz/refs/tags/v2.1.0
# 创建安装目录 mkdir -p /usr/local/kafka-eagle/ # 复制安装包到指定安装目录 cp kafka-eagle-bin-2.1.0.tar.gz /usr/local/kafka-eagle/ cd /usr/local/kafka-eagle/ # 解压 tar -zxvf kafka-eagle-bin-2.1.0.tar.gz cd kafka-eagle-bin-2.1.0 # 解压 tar -zxvf efak-web-2.1.0-bin.tar.gz
vim /etc/profile #Kafka_eagle export KE_HOME=/usr/local/kafka-eagle/kafka-eagle-bin-2.1.0/efak-web-2.1.0 KE_PATH=$PATH:$KE_HOME/bin export KE_PATH
source /etc/profile
修改配置文件:
cd /usr/local/kafka-eagle/kafka-eagle-bin-2.1.0/efak-web-2.1.0/conf vim system-config.properties
修改配置内容:
###################################### # multi zookeeper & kafka cluster list # Settings prefixed with 'kafka.eagle.' will be deprecated, use 'efak.' instead ###################################### # zookeeper集群 efak.zk.cluster.alias=cluster1 cluster1.zk.list=192.168.252.160:2181 ###################################### # kafka mysql jdbc driver address ###################################### efak.driver=com.mysql.cj.jdbc.Driver efak.url=jdbc:mysql://127.0.0.1:3306/ke?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull efak.username=root efak.password=123456
说明:
efak.url: 在启动kafka-eagle时候会自动执行脚本,创建相应的数据库
cd ../bin/ chmod +x ke.sh ./ke.sh start
启动成功打印日志如下:
如果出现错误,请查看日志日志是否出问题tailf ../log/log.log
Kafka系统默认是没有开启JMX端口的,所以Kafka Eagle的监控趋势图默认采用不启用的方式,即kafka.eagle.metrics.charts=false。如果需要查看监控趋势图,需要开启Kafka系统的JMX端口,设置该端口在$KAFKA_HOME/bin/kafka-server-start.sh脚本中,设置内容如下:
vim /usr/local/kafka-eagle/kafka-eagle-bin-2.1.0/efak-web-2.1.0/conf/system-config.properties
###################################### # enable kafka metrics ###################################### kafka.eagle.metrics.charts=true kafka.eagle.sql.fix.error=true
vi /opt/software/kafka/bin/kafka-server-start.sh
if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then export KAFKA_HEAP_OPTS="-server -Xms2G -Xmx2G -XX:PermSize=128m -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:ParallelGCThreads=8 -XX:ConcGCThreads=5 -XX:InitiatingHeapOccupancyPercent=70" # 这里的端口不一定非要设置成9999,端口只要可用,均可。 export JMX_PORT="9999" #export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G" fi
Kafka Eagle系统会自动获取这个JMX端口,采集结果如下: