一,需求简介
kafka集群部署完成后需要有一个可视化web页面,便于实时查看和观测kafka集群状态,我这里使用kafka eagle监控集群状态。
二、安装部署流程
1、Kafka Eagle 整个系统所包含的功能,
image.png
2、资源如下:
- 源码: https://github.com/smartloli/kafka-eagle/
- 官网:https://www.kafka-eagle.org/
- 下载: http://download.kafka-eagle.org/
- 安装文档: https://docs.kafka-eagle.org/2.env-and-install
下载地址:https://github.com/smartloli/kafka-eagle-bin/archive/v2.1.0.tar.gz
3、解压缩包重命名目录 (此处注意,需要解压两次)
mkdir /mnt/data
tar -zxvf kafka-eagle-bin-2.0.6.tar.gz
cd /mnt/data/kafka-eagle-bin-2.0.6
tar -zxvf kafka-eagle-web-2.0.6-bin.tar.gz
cd /mnt/data/kafka-eagle-bin-2.0.6/kafka-eagle-web-2.0.6
4、配置环境变量
设置Kafka-Eagle目录
#kafka-eagle
#export JAVA_HOME=/kafka/jdk1.8.0_65
export KE_HOME=/mnt/data/kafka-eagle-bin-2.0.6/kafka-eagle-web-2.0.6
export PATH=$PATH:$KE_HOME/bin:$JAVA_HOME/bin
5、更新环境变量
source /etc/profile
6、修改Kafka-Eagle配置文件
cd /mnt/data/kafka-eagle-bin-2.0.6/kafka-eagle-web-2.0.6/conf
vim system-config.properties
######################################
# multi zookeeper&kafka cluster list
# zookeeper和kafka集群配置
######################################
kafka.eagle.zk.cluster.alias=cluster1
cluster1.zk.list=10.0.0.11:2181,10.0.0.12:2181,10.0.0.13:21813
######################################
# kafka eagle webui port
# web页面访问端口号
######################################
kafka.eagle.webui.port=8080
######################################
# kafka mysql jdbc driver address
######################################
kafka.eagle.driver=com.mysql.cj.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=Sirun@2018
7、启动kafka-eagle
cd /mnt/data/kafka-eagle-bin-2.0.6/kafka-eagle-web-2.0.6/bin
./ke.sh start
8、启动成功打印日志如下;
*******************************************************************
* 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://127.0.0.1:8080'
* Account:admin ,Password:123456
*******************************************************************
* ke.sh [start|status|stop|restart|stats]
* https://www.kafka-eagle.org/
*******************************************************************
9、如果没问题,则直接登录
- image.png
-
默认用户名:admin
-
默认密码:12345
监控趋势图
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端口
参考链接:https://www.jianshu.com/p/db9f37bb7f98
其他可视化工具链接:https://toscode.gitee.com/dushixiang/kafka-map,此工具需要java11版本。
网友评论