本文主要介绍Apache和CDH平台下kafka eagle的安装配置教程,Cloudera CDP平台可以选择自带的SMM,也可以像CDH一样配置kafka eagle(推荐)。
kafka eagle(英文kafka鹰,又名EFAK) 是一款由国内公司开源的Kafka集群监控系统,可以用来监视kafka集群的broker状态、Topic信息、IO、内存、consumer线程、偏移量等信息,并进行可视化图表展示。独特的KQL还可以通过SQL在线查询kafka中的数据。
官网地址 https://www.kafka-eagle.org/
github地址:https://github.com/smartloli/EFAK
下载地址http://download.kafka-eagle.org/
本文安装的是3.0.1版本,支持Kafka版本0.8,0.9.x,0.10.x,0.11.x,1.x,2.x
wget https://github.com/smartloli/kafka-eagle-bin/archive/v3.0.1.tar.gz
tar -zvxf v3.0.1.tar.gz
cd kafka-eagle-bin-3.0.1/
tar -zxvf kafka-eagle-web-3.0.1-bin.tar.gz -C /opt/bd/
cd ../
mv kafka-eagle-web-3.0.1 kafka-eagle
MySQL > create database ke;
vim /etc/profile
export KE_HOME=/opt/bd/kafka-eagle
export PATH=$PATH:$KE_HOME/bin
source /etc/profile
修改配置文件
cd ${KE_HOME}/conf
vim system-config.properties
kafka.eagle.zk.cluster.alias=cluster1
cluster1.zk.list=tdn1:2181,tdn2:2181,tdn3:2181/kafka
注释掉sqlite jdbc driver address 修改mysql jdbc driver address 改成自己的MySQL密码
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
#Mysql密码
kafka.eagle.username=root
kafka.eagle.password=123456
eagle通过jmx收集一些指标,在使用jmx之前需要确保kafka开启了jmx监控
开启方法1:kafka启动时要添加JMX_PORT=9999
开启方法2:vim 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"
export JMX_PORT="9999"
fi
修改每个broker节点的broker_java_opts:
-server -XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:InitiatingHeapOccupancyPercent=35 -XX:G1HeapRegionSize=16M -XX:MinMetaspaceFreeRatio=50 -XX:MaxMetaspaceFreeRatio=80 -XX:+DisableExplicitGC -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dcom.sun.management.jmxremote=true
配置项 | 默认值 | 解释 |
---|---|---|
kafka.eagle.sql.fix.error | false | kafka sql查询失败是否允许自动修复 |
cluster1.zk.list | ke01:2181,ke02:2181,ke03:2181/cluster1 | zookeeper 集群地址. |
kafka.zk.limit.size | 25 | eagle连接 Zookeeper 的最大client数. |
cluster1.kafka.eagle.broker.size | 10 | Kafka broker size online list. |
kafka.eagle.webui.port | 8048 | Kafka Eagle webui 端口. |
cluster1.kafka.eagle.offset.storage | kafka | Kafka消费者offsets 存储位置kafka.0.10前版本是zookeeper |
kafka.eagle.sql.topic.records.max | 5000 | Kafka Eagle SQL 每次查询的最大记录数 |
cluster1.kafka.eagle.sasl.enable=true
cluster1.kafka.eagle.sasl.protocol=SASL_PLAINTEXT
cluster1.kafka.eagle.sasl.mechanism=GSSAPI
cluster1.kafka.eagle.sasl.jaas.config=com.sun.security.auth.module.Krb5LoginModule required useKeyTab=true storeKey=true keyTab="/etc/security/keytabs/kafka_client.keytab" principal="[email protected]";
# make sure there is a local ticket cache "klist -l" to view
# cluster1.kafka.eagle.sasl.jaas.config=com.sun.security.auth.module.Krb5LoginModule required useTicketCache=true renewTicket=true serviceName="kafka-eagle.org";
# if your kafka cluster doesn't require it, you don't need to set it up
# cluster1.kafka.eagle.sasl.client.id=
# Add zookeeper acl
cluster1.zk.acl.enable=true
cluster1.zk.acl.schema=digest
cluster1.zk.acl.username=test
cluster1.zk.acl.password=test123
######################################
# kafka jmx acl and ssl authenticate
######################################
cluster1.kafka.eagle.jmx.acl=true
cluster1.kafka.eagle.jmx.user=keadmin
cluster1.kafka.eagle.jmx.password=keadmin123
cluster1.kafka.eagle.jmx.ssl=false
cluster1.kafka.eagle.jmx.truststore.location=/Users/dengjie/workspace/ssl/certificates/kafka.truststore
cluster1.kafka.eagle.jmx.truststore.password=ke123456
######################################
kafka jmx uri(建议保持默认)
cluster1.kafka.eagle.jmx.uri=service:jmx:rmi:///jndi/rmi://%s/jmxrmi
$KE_HOME/bin/ke.sh start
进度条100%后会出现启动成功界面,端口默认8048
输入密码 admin/123456 登录即可
其他命令
$KE_HOME/bin/ke.sh [start|status|stop|restart|stats]
可以设置域名让浏览器缓存js文件,大大提高加载速度。
www.kafka-eagle.org
本文发自csdn,尊重原创,转载请先经过许可