1. 程式人生 > 其它 >Kafka-eagle安裝

Kafka-eagle安裝

技術標籤:kafkakafka-eaglekafka

一、背景

Kafka叢集搭建以後,需要一個實時監控工具,這裡選擇開源的Kafka-eagle。

Kafka Eagle是一款用於監控和管理Apache Kafka的完全開源系統,目前託管在Github,由筆者和一些開源愛好者共同維護。它提供了完善的管理頁面,很方面的去管理和視覺化Kafka叢集的一些資訊,例如Broker詳情、效能指標趨勢、Topic集合、消費者資訊等,同時,相容若干Kafka版本。

Github地址:https://github.com/smartloli/kafka-eagle

下載安裝地址:http://www.kafka-eagle.org/articles/docs/installation/linux-macos.html

二、安裝kafka-eagle

1、下載上傳到伺服器並解壓;
2、配置環境變數

$ vi /etc/profile
# 在文末加入以下內容
export KE_HOME=/usr/local/src/kafka-eagle
export PATH=$PATH:$KE_HOME/bin

3、修改kakfa-eagle的配置檔案:vi conf/system-config.properties

######################################
# 設定Kafka叢集,這裡只需要設定Zookeeper,系統會自動識別Kafka Broker
######################################
kafka.eagle.zk.cluster.alias=cluster1
cluster1.zk.list=host-80:2182,host-92:2182,host-98:2182,host-99:2182
#cluster2.zk.list=xdn10:2181,xdn11:2181,xdn12:2181

######################################
# zookeeper enable acl
######################################
cluster1.zk.acl.enable=false
cluster1.zk.acl.schema=digest
cluster1.zk.acl.username=test
cluster1.zk.acl.password=test123

######################################
# broker size online list
######################################
cluster1.kafka.eagle.broker.size=20

######################################
# zk client thread limit
######################################
kafka.zk.limit.size=25

######################################
# kafka-eagle web訪問埠
######################################
kafka.eagle.webui.port=8048

######################################
# kafka jmx acl and ssl authenticate
######################################
cluster1.kafka.eagle.jmx.acl=false
cluster1.kafka.eagle.jmx.user=keadmin
cluster1.kafka.eagle.jmx.password=keadmin123
cluster1.kafka.eagle.jmx.ssl=false
cluster1.kafka.eagle.jmx.truststore.location=/Users/dengjie/workspace/ssl/certificates/kafka.truststore
cluster1.kafka.eagle.jmx.truststore.password=ke123456

######################################
# kafka offset storage
######################################
cluster1.kafka.eagle.offset.storage=kafka
cluster2.kafka.eagle.offset.storage=zk

######################################
# 開啟效能監控,資料預設保留15天
######################################
kafka.eagle.metrics.charts=true
kafka.eagle.metrics.retain=15

######################################
# kafka sql topic records max
######################################
kafka.eagle.sql.topic.records.max=5000

######################################
# delete kafka topic token
######################################
kafka.eagle.topic.token=keadmin

######################################
# 配置kafka-sasl-scram許可權認證
# 開啟Kafka ACL特性,例如SCRAM或者PLAIN,
# 一般生產環境會使用SCRAM來做ACL,應為SCRAM
# 可以動態建立和管理使用者。
######################################
cluster1.kafka.eagle.sasl.enable=true
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="your name" password="your pw";
cluster1.kafka.eagle.sasl.client.id=
cluster1.kafka.eagle.blacklist.topics=
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.blacklist.topics=
cluster2.kafka.eagle.sasl.cgroup.enable=false
cluster2.kafka.eagle.sasl.cgroup.topics=

######################################
# kafka ssl authenticate
######################################
cluster3.kafka.eagle.ssl.enable=false
cluster3.kafka.eagle.ssl.protocol=SSL
cluster3.kafka.eagle.ssl.truststore.location=
cluster3.kafka.eagle.ssl.truststore.password=
cluster3.kafka.eagle.ssl.keystore.location=
cluster3.kafka.eagle.ssl.keystore.password=
cluster3.kafka.eagle.ssl.key.password=
cluster3.kafka.eagle.blacklist.topics=
cluster3.kafka.eagle.ssl.cgroup.enable=false
cluster3.kafka.eagle.ssl.cgroup.topics=

######################################
# 儲存Kafka Eagle元資料資訊的資料庫,目前支援
# MySQL和Sqlite,預設使用Sqlite進行儲存
# ke.db的路徑為自己的安裝路徑
######################################
kafka.eagle.driver=org.sqlite.JDBC
kafka.eagle.url=jdbc:sqlite:/opt/bfd/kafka-eagle/kafka-eagle-bin-2.0.3/kafka-eagle-web/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://127.0.0.1:3306/ke?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
#kafka.eagle.username=root
#kafka.eagle.password=123456

4、啟動kafka-eagle

# 啟動kafak-eagle
$ bin/ke.sh start
# 檢視執行狀態
$ bin/ke.sh status
# 停止kafak-eagle
$ bin/ke.sh stop
# 檢視Kafka Eagle GC情況
$ ke.sh gc
# 檢視Kafka Eagle版本號
$ ke.sh version

5、啟動以後訪問web介面,會發現kafka和zookeeper的版本號和modle顯示unkno,並且kafka-eagle日誌報錯,此時需要開啟kafka的JMX_PORT

(1)編輯 kafka啟動指令碼,啟用JMX_PORT

$ vi kafka-server-start.sh
# 加入 export JMX_PORT=9996

(2)編輯zookeeper的配置檔案

$ vi conf/zoo.cfg
# 加入以下配置
$ 4lw.commands.whitelist=*

如上配置完以後,重啟kafka、zookeeper和kafka-eagle,發現kafka-eagle不再報錯,web頁面也可正常顯示kafka和zk版本號.

完結撒花!