文章目錄
- 一、Kafka Eagle 下載下傳、編譯流程
- 1. Kafka Eagle下載下傳
- 2. 解壓Kafka Eagle
- 3. 進入解壓的目錄
- 4. 編譯項目
- 5. 添加編譯環境
- 6. 運作腳本編譯項目
- 二、Kafka Eagle 正式配置流程
- 2.1. 進入編譯獲得web目錄
- 2.2. 将編譯後的tar解壓到/app目錄
- 2.3. 在/app目錄下面檢視
- 2.4. 配置檔案總覽簡述
- 2.5. 配置檔案修改
- 三、修改kafka配置
- 3.1. 修改 kafka 啟動指令
- 3.2. 同步配置檔案到ly-02 ly-03節點
- 3.3. 啟動zk叢集腳本
- 3.4. 啟動kafka叢集腳本
- 3.6. 啟動kafka eagle
- 四、登入web頁面
- 4.1. 浏覽器通路
- 4.2. 登入
- 4.2. 登入後頁面
一、Kafka Eagle 下載下傳、編譯流程
1. Kafka Eagle下載下傳
wget https://github.com/smartloli/kafka-eagle/archive/v1.4.3.tar.gz
2. 解壓Kafka Eagle
tar -zxf v1.4.3.tar.gz
3. 進入解壓的目錄
cd kafka-eagle-1.4.3/
4. 編譯項目
前提:Centos7 安裝maven,如果沒有安裝,請點選連結,先安裝maven。
5. 添加編譯環境
不添加會抛出以下錯誤
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project kafka-eagle-common: Compilation failure: Compilation failure:
[ERROR] /usr/local/src/kafka/kafka-eagle/kafka-eagle-common/src/main/java/org/smartloli/kafka/eagle/common/util/KafkaZKPoolUtils.java:[44,84] diamond operator is not supported in -source 1.5
[ERROR] (use -source 7 or higher to enable diamond operator)
按照大神的說法,修改pom.xml檔案,在最後一行之前添加以下内容:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
6. 運作腳本編譯項目
./build.sh
編譯後成功的截圖:
二、Kafka Eagle 正式配置流程
2.1. 進入編譯獲得web目錄
cd /app/software/kafka-eagle-1.4.3/kafka-eagle-web/target
2.2. 将編譯後的tar解壓到/app目錄
tar -zxvf kafka-eagle-web-1.4.3-bin.tar.gz -C /app/
2.3. 在/app目錄下面檢視
2.4. 配置檔案總覽簡述
cd /app/kafka-eagle-web-1.4.3/conf
vim system-config.properties
######################################
#設定Kafka多叢集,這裡隻需要設定Zookeeper,
# 系統會自動識别Kafka Broker
# multi zookeeper & kafka cluster list
######################################
kafka.eagle.zk.cluster.alias=cluster1
cluster1.zk.list=ly-01:2181,ly-02:2181,ly-03:2181
######################################
#Zookeeper線程池最大連接配接數
# zk client thread limit
######################################
kafka.zk.limit.size=25
######################################
# Kafka Eagle的頁面通路端口
# kafka eagle webui port
######################################
kafka.eagle.webui.port=8048
######################################
# 存儲消費資訊的類型,一般在0.9版本之前,消費
# 資訊會預設存儲在Zookeeper中,是以存儲類型
# 設定zookeeper即可,如果是在0.10版本之後,
# 消費者資訊預設存儲在Kafka中,是以存儲類型
# 設定為kafka。而且,在使用消費者API時,盡量
# 用戶端Kafka API版本和Kafka服務端的版本保持
# 一緻性。
# kafka offset storage
######################################
cluster1.kafka.eagle.offset.storage=kafka
######################################
# 開啟性能監控,資料預設保留30天
# kafka metrics, 30 days by default
######################################
kafka.eagle.metrics.charts=true
kafka.eagle.metrics.retain=30
######################################
# KSQL查詢Topic資料預設是最新的5000條,如果
# 在使用KSQL查詢的過程中出現異常,可以将下面
# 的false屬性修改為true,Kafka Eagle會在
# 系統中自動修複錯誤。
# kafka sql topic records max
######################################
kafka.eagle.sql.topic.records.max=5000
kafka.eagle.sql.fix.error=false
######################################
# delete kafka topic token
######################################
# 删除Kafka Topic時需要輸入删除密鑰,由
# 管理者執行
######################################
kafka.eagle.topic.token=keadmin
######################################
# 開啟Kafka ACL特性,例如SCRAM或者PLAIN,
# 一般生産環境會使用SCRAM來做ACL,應為SCRAM
# 可以動态建立和管理使用者。
# 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 Eagle中繼資料資訊的資料庫,目前支援
# MySQL和Sqlite,預設使用Sqlite進行存儲
# 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 Eagle中繼資料資訊的資料庫,目前支援
# MySQL和Sqlite,預設使用Sqlite進行存儲
# kafka mysql jdbc driver address
######################################
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=root
2.5. 配置檔案修改
cd /app/kafka-eagle-web-1.4.3/conf
vim system-config.properties
第1處 第4行
配置zk叢集資訊
kafka.eagle.zk.cluster.alias=cluster1
cluster1.zk.list=ly-01:2181,ly-02:2181,ly-03:2181
修改第2處 第20行
配置zk叢集資訊
cluster1.kafka.eagle.offset.storage=kafka
修改第3處 第30行
開啟儀表盤顯示
kafka.eagle.metrics.charts=true
修改第4處 注釋第67行 至70行
關閉 預設使用Sqlite進行存儲
開啟存儲Kafka Eagle中繼資料資訊的MySQL資料庫,
kafka.eagle.driver=com.mysql.jdbc.Driver
kafka.eagle.url=jdbc:mysql://127.0.0.1:3306/ke?useUnicode=true&characterEncoding=UTF-8&zeroD ateTimeBehavior=convertToNull
kafka.eagle.username=root
kafka.eagle.password=root
三、修改kafka配置
3.1. 修改 kafka 啟動指令
修改
kafka-server-start.sh
指令中
if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then
export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G"
fi
為
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"
#export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G"
fi
注意:修改之後在啟動 Kafka 之前要分發或者同步到其他2個節點
3.2. 同步配置檔案到ly-02 ly-03節點
scp /app/kafka/bin/kafka-server-start.sh root@ly-02:/app/kafka/bin
scp /app/kafka/bin/kafka-server-start.sh root@ly-03:/app/kafka/bin
3.3. 啟動zk叢集腳本
./zkmanage.sh start
腳本内容:
#!/bin/bash
for host in ly-01 ly-02 ly-03
do
echo "${host}:$1ing....."
ssh $host "source /etc/profile;/app/zookeeper-3.5.7/bin/zkServer.sh $1"
done
sleep 2
for host in ly-01 ly-02 ly-03
do
ssh $host "source /etc/profile;/app/zookeeper-3.5.7/bin/zkServer.sh status"
done
附上:zk停止指令
./zkmanage.sh stop
3.4. 啟動kafka叢集腳本
./kk-start.sh
kafka啟動腳本内容:
#!/bin/bash
for host in ly-01 ly-02 ly-03
do
echo "${host}:$1 kafka starting....."
ssh $host "source /etc/profile;/app/kafka/bin/kafka-server-start.sh -daemon /app/kafka/config/server.properties"
done
kafka 關閉叢集 腳本内容:
#!/bin/bash
for host in ly-01 ly-02 ly-03
do
echo "${host}:$1 kafka stopping....."
ssh $host "source /etc/profile;/app/kafka/bin/kafka-server-stop.sh /app/kafka/config/server.properties"
done
3.6. 啟動kafka eagle
cd /app/kafka-eagle-web-1.4.3/bin
./ke.sh start
注:低版本号好像需要賦予權限
chmod u+x ke.sh
運作腳本後截圖
四、登入web頁面
4.1. 浏覽器通路
http://192.168.43.32:8048/ke 賬号/密碼:admin/123456