参考资料:
参考视频
Kafka-eagle官网
解释:Kafka-eagle 后来更名为 EFAK ,所以打开官网会显示EFAK
环境准备:
要有本服务器可访问的MySQL服务,远程的请检查是否已经开启了MySQL远程访问,如果没有则需要安装MySQL,建议在本服务器安装,参考中的数据库安装教程有已经可启动的Kafka服务,且和它配套的zookeeper,如果没有,请参考Kafka单机版或Kafka集群版进行部署基础环境准备好后,还需要保证MySQL服务开启状态,Kafka和Zookeeper 服务处于关闭状态,才能进行Kafka-eagle服务的安装要求虚拟机的内存至少3G以上,否则无法启动 配置Kafka的启动脚本,进行内存扩容打开Kafka 启动脚本 进行编辑 ,我的目录是:
vim /usr/local/soft/kafka_2.13-3.3.1/bin/kafka-server-start.sh
将
if [ "x$KAFKA_HEAP_OPTS" = "x" ]; thenexport KAFKA_HEAP_OPTS="-Xmx1G -Xms1G"fi
替换为
if [ "x$KAFKA_HEAP_OPTS" = "x" ]; thenexport 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"# export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G"fi
整体如下:
#!/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## /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 ];thenecho "USAGE: $0 [-daemon] server.properties [--override property=value]*"exit 1fibase_dir=$(dirname $0)if [ "x$KAFKA_LOG4J_OPTS" = "x" ]; thenexport 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"#fiif [ "x$KAFKA_HEAP_OPTS" = "x" ]; thenexport 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"# export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G"fi
保存退出
服务器应该关闭防火墙
安装过程:
首先登录Kafka官网,下载安装包 将下载好的安装包,上传至Linux目录/usr/local/soft (这不是一个系统默认目录,所以请先创建),上传文件软件推荐MobaXterm对压缩包进行解压然后进入到解压目录,再次对里面的 压缩包进行解压,并解压到/usr/local/softtar -zxvf kafka-eagle-bin-3.0.1.tar.gz
然后返回上一级,删除 压缩包,以及第一次解压缩的文件夹# 打开目录
cd kafka-eagle-bin-3.0.1/
# 解压到/usr/local/soft
tar -zxvf efak-web-3.0.1-bin.tar.gz -C /usr/local/soft/
然后对 第二次解压缩的包 进行重命名# 返回上一级
cd ..
# 删除压缩包,以及第一次解压缩的包
rm -rf kafka-eagle-bin-3.0.1.tar.gz kafka-eagle-bin-3.0.1
然后 配置环境变量mv efak-web-3.0.1/ efak
vim /etc/profile
将 下面的 拷入到 profile 文件的末尾
export KE_HOME=/usr/local/soft/efak
export PATH=$PATH:$KE_HOME/bin
注意:KE_HOME 一定要是bin目录的上一级,否则环境变量配置失败
保存退出后,更新配置
然后 配置 kafka-eagle 的启动参数source /etc/profile
重点修改这些,以单个zookeeper节点为例vim /usr/local/soft/efak/conf/system-config.properties
首先将zookeeper 的IP地址
因为是单节点 zookeeper ,即单节点组成的单集群,所以集群变为cluster1,然后cluster1填写zookeeper的IP和端口。
然后修改偏移量的存储位置,因为不存在集群2,所以我们将集群2注释掉
然后就是填写数据库的地址,如果是远程的请保证它开启了远程访问权限
efak.driver=com.mysql.jdbc.Driverefak.url=jdbc:mysql://192.168.192.203:3306/ke?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNullefak.username=rootefak.password=*******
保存退出。
启动访问:
首先正常 启动zookeeper 然后启动 Kafka ,如果不会参照启动Kafka -eagle ,打开 安装目录下的bin目录,我的是然后输入脚本进行启动cd/usr/local/soft/efak/bin
sh ke.sh start
然后输入脚本验证是否运行正常,如果显示running表示运行正常
然后在浏览器中,输入部署服务器的IP+8048,如:sh ke.sh status
192.168.192.203:8048
注意:是8048,不是8084,很容易弄错
输入账号密码,见linux服务器启动提示: 提示,如果出错 ,在/efak/logs文件夹会有相关日志打印,可以找到原因
如果觉得《Kafka-eagle 安装教程》对你有帮助,请点赞、收藏,并留下你的观点哦!