kafka管理界面 kafka-eagle

给kafka配一个web版的管理页面或仪表盘,管理起来更加方便

安装过程记录

解压缩包重命名目录

mkdir /opt/software
tar xf kafka-eagle-bin-1.3.8.tar.gz -C /opt/software/
cd /opt/software/kafka-eagle-bin-1.3.8
tar xf kafka-eagle-web-1.3.8-bin.tar.gz
mv kafka-eagle-web-1.3.8 kafka-eagle

配置环境变量

  1. 设置Kafka-Eagle目录
vim /etc/profile
export KE_HOME= /opt/software/kafka-eagle
PATH=$PATH:$KE_HOME/bin
  1. 设置java目录
vim /etc/profile
export JAVA_HOME= /usr/local/java/

更新环境变量

source /etc/profile

修改Kafka-Eagle配置文件

cd kafka-eagle/conf
vim system-config.properties
######################################
# multi zookeeper&kafka cluster list
# zookeeper和kafka集群配置
######################################
kafka.eagle.zk.cluster.alias=cluster1
cluster1.zk.list=10.0.0.200:2181,10.0.0.200:2182,10.0.0.200:2183
######################################
# kafka eagle webui port 
# web页面访问端口号
######################################
kafka.eagle.webui.port=8048
######################################
# kafka jdbc driver address
# kafka默认使用sqlite数据库,Centos自带,注意配置下数据库存放路径就行
######################################
kafka.eagle.driver=org.sqlite.JDBC
kafka.eagle.url=jdbc:sqlite:/opt/software/kafka-eagle/db/ke.db
kafka.eagle.username=root
kafka.eagle.password=www.kafka-eagle.org

启动kafka-eagle

cd ../bin/
chmod +x ke.sh
./ke.sh start

启动成功打印日志如下;

*******************************************************************
* Kafka Eagle system monitor port successful...
*******************************************************************
[2020-02-07 17:05:57] INFO: Status Code[0]
[2020-02-07 17:05:57] INFO: [Job done!]
Welcome to
__ __ ___ ____ __ __ ___ ______ ___ ______ __ ______
/ //_/ / | / __/ / //_/ / | / ____/ / | / ____/ / / / ____/
/ ,< / /| | / /_ / ,< / /| | / __/ / /| | / / __ / / / __/
/ /| | / ___ | / __/ / /| | / ___ | / /___ / ___ |/ /_/ / / /___ / /___
/_/ |_| /_/ |_|/_/ /_/ |_| /_/ |_| /_____/ /_/ |_|\____/ /_____//_____/
Version 1.3.8
*******************************************************************
* Kafka Eagle Service has started success.
* Welcome, Now you can visit 'http://10.0.0.200:8048/ke'
* Account:admin ,Password:123456
*******************************************************************
* ke.sh [start|status|stop|restart|stats]
* https://www.kafka-eagle.org/
*******************************************************************

如果出现错误,请查看日志日志是否出问题
tailf ../log/log.log
如果没问题,则直接登录

监控趋势图

Kafka系统默认是没有开启JMX端口的,所以Kafka Eagle的监控趋势图默认采用不启用的方式,即kafka.eagle.metrics.charts=false。如果需要查看监控趋势图,需要开启Kafka系统的JMX端口,设置该端口在$KAFKA_HOME/bin/kafka-server-start.sh脚本中,设置内容如下:

vim  /opt/software/kafka-eagle/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端口,采集结果如下:


推荐阅读更多精彩内容