 
   
    ######################################
    
    # multi zookeeper & kafka cluster list
    
    ######################################
    
    kafka.eagle.zk.cluster.alias=cluster1
    
    cluster1.zk.list=hadoop101:2181,hadoop102:2181,hadoop103:2181
    
    #cluster2.zk.list=xdn10:2181,xdn11:2181,xdn12:2181
   
    ######################################
    
    # broker size online list
    
    ######################################
    
    cluster1.kafka.eagle.broker.size=20
   
    ######################################
    
    # 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
    
    cluster2.kafka.eagle.offset.storage=zk
   
    ######################################
    
    # kafka metrics, 30 days by default
    
    ######################################
    
    kafka.eagle.metrics.charts=true
    
    kafka.eagle.metrics.retain=30
   
    
    ######################################
    
    # kafka sql topic records max
    
    ######################################
    
    kafka.eagle.sql.topic.records.max=5000
    
    kafka.eagle.sql.fix.error=false
   
    ######################################
    
    # 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=SCRAM-SHA-256
    
    cluster1.kafka.eagle.sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username=”kafka” password=”kafka-eagle”;
    
    cluster1.kafka.eagle.sasl.client.id=
    
    cluster1.kafka.eagle.sasl.cgroup.enable=false
    
    cluster1.kafka.eagle.sasl.cgroup.topics=
   
    cluster2.kafka.eagle.sasl.enable=false
    
    cluster2.kafka.eagle.sasl.protocol=SASL_PLAINTEXT
    
    cluster2.kafka.eagle.sasl.mechanism=PLAIN
    
    cluster2.kafka.eagle.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username=”kafka” password=”kafka-eagle”;
    
    cluster2.kafka.eagle.sasl.client.id=
    
    cluster2.kafka.eagle.sasl.cgroup.enable=false
    
    cluster2.kafka.eagle.sasl.cgroup.topics=
   
    ######################################
    
    # kafka sqlite jdbc driver address
    
    ######################################
    
    #kafka.eagle.driver=org.sqlite.JDBC
    
    #kafka.eagle.url=jdbc:sqlite:/hadoop/kafka-eagle/db/ke.db
    
    #kafka.eagle.username=root
    
    #kafka.eagle.password=www.kafka-eagle.org
   
    ######################################
    
    # kafka mysql jdbc driver address
    
    ######################################
    
    kafka.eagle.driver=com.mysql.jdbc.Driver
    
    kafka.eagle.url=jdbc:mysql://hadoop101:3306/ke?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
    
    kafka.eagle.username=root
    
    kafka.eagle.password=fei123AA!
   
开心找到原因了,分析如下:
    一般搭建kafka监控的时候kafka和zk都已经搭建好了这里需要主意一个地方
    
    1.kafka需要开启JMX端口
    
    找到kafka安装路径,进入到bin文件夹,修改下面的地方。
    
    vi 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
    
    …
    
    参考链接:[kafka添加jmx端口]:https://ke.smartloli.org/3.Manuals/11.Metrics.html
    2.了解kafka在zookeeper配置
    
    需要查看kafka的server.properties配置
    
    找到zookeeper.connect此项配置,这个是要配置到eagle里面的
    
    # root directory for all kafka znodes.
    
    zookeeper.connect=g1-jg-hadoop-37:2181,g1-jg-hadoop-38:2181,g1-jg-hadoop-53,g1-jg-hadoop-54,g1-jg-hadoop-55:2181/kafka-hadoop-logs
    
    !!!PS:此处踩了坑,如果说这里的zookeeper地址后面加了其他路径,在kafka-eagle里面也要配置,
    
    否则在kafka-eagle的Dashboard中无法读取到kafka的信息。比如我们有人安装的kafka集群里面就有
    
    192.168.18.11:2181/kafka1或者192.168.18.11:2181/kafka2这种地址。
    
    如果你在安装kafka的时候没有配置多余路径,这样是最好的,如果有一定要加上。
    
    pspsps!!!:kafka-eagle配置里面system-config.properties这里不要每个g1-jg-hadoop-38:2181后边都加路径只在最后边加一个就可以了
    
    cluster1.zk.list=g1-jg-hadoop-53:2181,g1-jg-hadoop-54:2181,g1-jg-hadoop-55:2181,g1-jg-hadoop-37:2181,g1-jg-hadoop-38:2181/kafka-hadoop-logs
    
    3.连通性测试
    
    安装kafka-eagle的服务器,一定要提前测试是否能连接kafka注册的zookeeper端口
    
    telnet 端口进行测试
   
总结:
kafka的server.properties配置
zookeeper.connect=hadoop101:2181,hadoop102:2181,hadoop103:2181/kafka
kafka-eagle的system-config.properties
cluster1.zk.list=hadoop101:2181,hadoop102:2181,hadoop103:2181/kafka
保持一样,可以解决这个问题哈。
     
   
 
