在安裝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,登錄查看是否成功!
如有問題,歡迎討論!!!