Kafka Eagle 安装和配置

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zimiao552147572/article/details/89066844

总帖:CDH 6系列(CDH 6.0、CHD6.1等)安装和使用

kafka-eagle监控kafka、zookeeper状态的监控工具:
    1.各版本下载 & 使用文档:https://ke.smartloli.org/5.ChangeLog/1.ChangeLog.html
      官网:https://ke.smartloli.org

    2.node1节点解压安装即可
        kafka-eagle-web-1.3.1-bin.tar.gz
          tar -zxvf kafka-eagle-web-1.3.1-bin.tar.gz
          mv kafka-eagle-web-1.3.1 kafka-eagle

    3.每台Linux都需要配置环境变量:
        1.vim /etc/profile
        2.在profile文件末尾添加以下配置:每个环境变量的末尾不能带有“/”
            export KE_HOME=/root/kafka-eagle
            export PATH=$PATH:$KE_HOME/bin
        3.重新加载环境变量配置文件:source /etc/profile

    4.修改配置文件system-config.properties:
        1.cd /root/kafka-eagle/conf/
        2.vim system-config.properties
            kafka.eagle.zk.cluster.alias=cluster1
            # zookeeper集群ip端口列表
            cluster1.zk.list=node1:2181,node2:2181,node3:2181
            # 如果集群的kafka是新版本(0.9.x或0.10.x以上),那么可以将值都设置成kafka。如果集群的kafka是老版本(0.8.x),那么可以将值都设置成zk
            cluster1.kafka.eagle.offset.storage=kafka
            kafka.eagle.metrics.charts=true # 是否启动监控图表,默认是false不启动的
            kafka.eagle.sql.fix.error=true # 在使用Kafka SQL查询主题时,如果遇到错误,可以尝试开启这个属性,默认情况下,不开启
            # 必须是解压目录下的 conf/kafka_client_jaas.conf
            cluster1.kafka.eagle.sasl.client=/root/kafka-eagle/conf/kafka_client_jaas.conf
            # Kafka Eagle默认存储在Sqlite中,如果要使用 MySQL可以替换驱动、用户名、密码、连接地址
            kafka.eagle.url=jdbc:sqlite:/root/kafka-eagle/db/ke.db  # 必须是解压目录下的 db/ke.db 
            kafka.eagle.username=root
            kafka.eagle.password=123456

        Kafka 0.8.2.x(存放消费信息于Zookeeper)以及 0.10.x(存放消费信息于Kafka的topic中)

        这里需要注意的时,Kafka在0.10.x之后的版本和之前的版本底层设计有了变化,在之前的版本消费者信息是存储在Zookeeper中的,
        在0.10.x版本之后,默认存储到了Kafka内部主题中,只保留了元数据信息存储在Zookeeper中,例如:Kafka Broker地址、Topic名称、分区等信息。
        是不是我使用的是Kafka 0.10.x之后的版本(如0.10.0、1.0.x、1.x等),然后配置属性kafka.eagle.offset.storage=kafka,
        启动消费者,就可以看到消费者信息呢?不一定的,还有一个关键因素决定Kafka Eagle系统是否可以展示你消费者程序信息,那就是消费者API的使用。
        如果你使用的Kafka 0.10.x之后的版本,然后消费者API也是使用的最新的写法,那么自然你的消费者信息会被记录到Kafka内部主题中,
        那么此时你设置kafka.eagle.offset.storage=kafka这个属性,Kafka Eagle系统可以完美展示你的消费者使用情况。
        但是,如果你虽然使用的是Kafka 0.10.x之后的版本,但是你使用的消费者API还是0.8.2.x或是0.9.x时的写法,
        此时的消费者信息是会被记录到Zookeeper中进行存储,那么此时你需要设置kafka.eagle.offset.storage=zookeeper或者注释掉该属性,
        在访问Kafka Eagle系统就可以查看到你的消费者详情了。


    5.启动
        cd /root/kafka-eagle/bin
        chmod 777 ke.sh
        ./ke.sh start    启动Kafka Eagle系统
        ./ke.sh stop    停止Kafka Eagle系统
        ./ke.sh restart    重启Kafka Eagle系统
        ./ke.sh status    查看Kafka Eagle系统运行状态
        ./ke.sh stats    统计Kafka Eagle系统占用Linux资源情况
        ./ke.sh find [ClassName]    查看Kafka Eagle系统中的类是否存在

    6.如果出现错误等情况,可查看日志
        /root/kafka-eagle/logs

    7.http://node1IP:8048/ke
      用户名admin
      密码123456


    8.kafka-eagle 查看数据、offset
        select "partition","offset","msg" from "test" where "partition" in (0,1,2) limit 1000
        select * from "test" where "partition" in (0,1,2)


============= system-config.properties完整配置介绍===============

# 多个 zookeeper 和 kafka 集群列表
# 可以多个 zookeeper集群 别名 
#kafka.eagle.zk.cluster.alias=cluster1,cluster2 
kafka.eagle.zk.cluster.alias=cluster1
#zookeeper集群ip端口列表
cluster1.zk.list=node1:2181,node2:2181,node3:2181 
#cluster2.zk.list=xdn10:2181,xdn11:2181,xdn12:2181


# zookeeper 客户端线程限制,即客户端zkCli最大个数
kafka.zk.limit.size=25


# kafka-eagle的webui页面的port
# kafka.eagle管控台访问端口 访问http://ip:8048/ke/
kafka.eagle.webui.port=8048


# kafka offset 的存储位置
# 对于新版本,官方默认将消费信息迁移到Kafka的topic中,这样原来的接口只能获取topic,broker等信息,对于消费的信息,我们需要从kafka中一个叫consumer_offsets的topic中获取
# 如果你的offsets存储在Kafka中,这里就配置属性值为kafka,如果是在Zookeeper中,这里就配置属性值为zk
# 如果集群的kafka是新版本(0.9.x或0.10.x以上),那么可以将值都设置成kafka。如果集群的kafka是老版本(0.8.x),那么可以将值都设置成zk
# 一般情况下,Offsets的也和你消费者API有关系,如果你使用的Kafka版本为0.10.x以上版本,但是,你的kafka消费API使用的是0.8.2.x时的API,此时消费者依然是在Zookeeper中
cluster1.kafka.eagle.offset.storage=kafka
#cluster2.kafka.eagle.offset.storage=zk


# 是否启动监控图表,默认是false不启动的
kafka.eagle.metrics.charts=true
# 在使用Kafka SQL查询主题时,如果遇到错误,可以尝试开启这个属性,默认情况下,不开启
kafka.eagle.sql.fix.error=true


# 在使用 Kafka SQL 查询 topic主题 时的 记录数最大值
kafka.eagle.sql.topic.records.max=5000


# 警报电子邮件配置,默认是false不启动的
kafka.eagle.mail.enable=false
[email protected]
[email protected]
kafka.eagle.mail.password=mqslimczkdqabbbh
kafka.eagle.mail.server.host=smtp.163.com
kafka.eagle.mail.server.port=25


# 警报IM(wechat、钉钉)配置
#kafka.eagle.im.dingding.enable=true
#kafka.eagle.im.dingding.url=https://oapi.dingtalk.com/robot/send?access_token=

#kafka.eagle.im.wechat.enable=true
#kafka.eagle.im.wechat.token=https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=xxx&corpsecret=xxx
#kafka.eagle.im.wechat.url=https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=
#kafka.eagle.im.wechat.touser=
#kafka.eagle.im.wechat.toparty=
#kafka.eagle.im.wechat.totag=
#kafka.eagle.im.wechat.agentid=


# 删除 kafka topic主题的 token令牌
kafka.eagle.topic.token=keadmin


# Kafka SASL认证,如果启动Kafka SASL协议开启该属性,默认是false不启动的
cluster1.kafka.eagle.sasl.enable=false
cluster1.kafka.eagle.sasl.protocol=SASL_PLAINTEXT
cluster1.kafka.eagle.sasl.mechanism=PLAIN
cluster1.kafka.eagle.sasl.client=/root/kafka-eagle/conf/kafka_client_jaas.conf
#cluster2.kafka.eagle.sasl.enable=false
#cluster2.kafka.eagle.sasl.protocol=SASL_PLAINTEXT
#cluster2.kafka.eagle.sasl.mechanism=PLAIN


# Kafka JDBC驱动程序地址
# Kafka Eagle默认存储在Sqlite中,如果要使用 MySQL可以替换驱动、用户名、密码、连接地址
kafka.eagle.driver=org.sqlite.JDBC
kafka.eagle.url=jdbc:sqlite:/root/kafka-eagle/db/ke.db
kafka.eagle.username=root
kafka.eagle.password=123456
#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=admin
 

============= system-config.properties 我使用的配置 ===============

######################################
# multi zookeeper&kafka cluster list
######################################
kafka.eagle.zk.cluster.alias=cluster1
cluster1.zk.list=node1:2181,node2:2181,node3:2181

######################################
# zk client thread limit
######################################
kafka.zk.limit.size=25

######################################
# kafka eagle webui port
######################################
kafka.eagle.webui.port=8048

######################################
# kafka offset storage
######################################
cluster1.kafka.eagle.offset.storage=kafka

######################################
# enable kafka metrics
######################################
kafka.eagle.metrics.charts=true
kafka.eagle.sql.fix.error=true

######################################
# kafka sql topic records max
######################################
kafka.eagle.sql.topic.records.max=5000

######################################
# alarm email configure
######################################
kafka.eagle.mail.enable=false
[email protected]
[email protected]
kafka.eagle.mail.password=mqslimczkdqabbbh
kafka.eagle.mail.server.host=smtp.163.com
kafka.eagle.mail.server.port=25

######################################
# alarm im configure
######################################
#kafka.eagle.im.dingding.enable=true
#kafka.eagle.im.dingding.url=https://oapi.dingtalk.com/robot/send?access_token=

#kafka.eagle.im.wechat.enable=true
#kafka.eagle.im.wechat.token=https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=xxx&corpsecret=xxx
#kafka.eagle.im.wechat.url=https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=
#kafka.eagle.im.wechat.touser=
#kafka.eagle.im.wechat.toparty=
#kafka.eagle.im.wechat.totag=
#kafka.eagle.im.wechat.agentid=

######################################
# delete kafka topic token
######################################
kafka.eagle.topic.token=keadmin

######################################
# kafka sasl authenticate
######################################
cluster1.kafka.eagle.sasl.enable=false
cluster1.kafka.eagle.sasl.protocol=SASL_PLAINTEXT
cluster1.kafka.eagle.sasl.mechanism=PLAIN
cluster1.kafka.eagle.sasl.client=/root/kafka-eagle/conf/kafka_client_jaas.conf

######################################
# kafka jdbc driver address
######################################
kafka.eagle.driver=org.sqlite.JDBC
kafka.eagle.url=jdbc:sqlite:/root/kafka-eagle/db/ke.db
kafka.eagle.username=root
kafka.eagle.password=123456


 

猜你喜欢

转载自blog.csdn.net/zimiao552147572/article/details/89066844