导航

安装Kafka-eagle时踩过的坑

Posted on 2020-12-11 16:34  乔伊_413  阅读(3478)  评论(1编辑  收藏  举报

在安装Kafka-eagle的时候遇见几个坑,在这里分享一下:

注意:版本问题,若按本文章不能解决,则着重查看版本的问题;这里只是提供解决针对问题的思路

Kafka版本:kafka_2.11-0.11.0.2

Kafka-eagle版本:kafka-eagle-bin-1.3.7

MySQL版本:5.7.28 MySQL

 

坑1:关于安装成功之后返回状态页500

需要使用到JMX端口,配置Kafka/bin下的 kafka-server-start.sh:

 

#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

if [ $# -lt 1 ];
then
    echo "USAGE: $0 [-daemon] server.properties [--override property=value]*"
    exit 1
fi
base_dir=$(dirname $0)

if [ "x$KAFKA_LOG4J_OPTS" = "x" ]; then
    export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:$base_dir/../config/log4j.properties"
fi
# 注意:这里是修改后的文件
if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then
    export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G"
  #添加代码如下: export JMX_PORT="9999" fi EXTRA_ARGS=${EXTRA_ARGS-'-name kafkaServer -loggc'} COMMAND=$1 case $COMMAND in -daemon) EXTRA_ARGS="-daemon "$EXTRA_ARGS shift ;; *) ;; esac exec $base_dir/kafka-run-class.sh $EXTRA_ARGS kafka.Kafka "$@"

 

 

 

解决:

  1. 进入eagle的bin目录下,编辑文件 ke.sh

 

 # 注释掉一下几行代码
#
rm -rf $KE_HOME/kms/webapps/ke #rm -rf $KE_HOME/kms/work #mkdir -p $KE_HOME/kms/webapps/ke #cd $KE_HOME/kms/webapps/ke #${JAVA_HOME}/bin/jar -xvf $KE_HOME/kms/webapps/
ke.war

 

  2. 进入到 /export/servers/kafka-eagle-bin-1.3.7/eagle/kms/webapps/ke/WEB-INF/lib 删除Jackson开头的jar包

rm -fr jackson-*.jar

  3. 启动 zk集群和Kafka集群,然后启动eagle:

# 注意要配置好环境变量,并source
zk.sh start

 

坑2:连接org.sqlite.JDBC没有问题,但是连接MySQL失败,一直进不去Dashboard页面

######################################
# 这里配置自己的集群,我这里只有一套,删除了原来的cluster2
######################################
kafka.eagle.zk.cluster.alias=cluster1
cluster1.zk.list=node01:2181,node02:2181,node03:2181

######################################
# 默认即可
######################################
kafka.zk.limit.size=25

######################################
# 默认即可
######################################
kafka.eagle.webui.port=8048

######################################
# 删除了cluster2,保留1,为Kafka,0.96版本之后,offset信息保存在Kafka集群中
######################################
cluster1.kafka.eagle.offset.storage=kafka

######################################
# 都设置为true
######################################
kafka.eagle.metrics.charts=true
kafka.eagle.sql.fix.error=true

######################################
# 默认即可
######################################
kafka.eagle.sql.topic.records.max=5000

######################################
# 默认即可,也可以设置为true
######################################
kafka.eagle.mail.enable=true
kafka.eagle.mail.sa=alert_sa@163.com
kafka.eagle.mail.username=alert_sa@163.com
kafka.eagle.mail.password=mqslimczkdqabbbh
kafka.eagle.mail.server.host=smtp.163.com
kafka.eagle.mail.server.port=25

######################################
# 默认
######################################
#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.eagle.topic.token=keadmin

######################################
# 默认
######################################
cluster1.kafka.eagle.sasl.enable=false
cluster1.kafka.eagle.sasl.protocol=SASL_PLAINTEXT
cluster1.kafka.eagle.sasl.mechanism=PLAIN

######################################
# kafka jdbc driver address
######################################
kafka.eagle.driver=com.mysql.jdbc.Driver
kafka.eagle.url=jdbc:mysql://你的IP:3306/ke?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
kafka.eagle.username=root
kafka.eagle.password=你的密码

# 之前返回500报错,使用sqlite测试 #kafka.eagle.driver
=org.sqlite.JDBC #kafka.eagle.url=jdbc:sqlite:/export/servers/kafka-eagle-bin-1.3.7/eagle/db/ke.db #kafka.eagle.username=root #kafka.eagle.password=你的密码

 

解决:

  1. 测试MySQL是否能够让外界连接到

  2. 进入到你的MySQL:

 

-- 进入MySQL, 123456是你的密码
mysql -u root -p123456

-- 使用mysql数据库
use mysql

-- 查看user表中的数据 root后面 有没有跟%
select  User,Host from user;

-- 如果没有,则使用以下命令 这里的root是你的用户名 123456是你的密码
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;

flush privileges;

-- 退出,最好使用Windows的MySQL工具连接一下测试

 

最后,启动eagle,登录查看是否成功!

如有问题,欢迎讨论!!!