docker-compose 如何快速部署 EFAK

后端 潘老师 5个月前 (12-10) 123 ℃ (0)

本文主要讲解关于docker-compose 如何快速部署 EFAK 相关内容,让我们来一起学习下吧!

一、概述

EFAKEagle For Apache Kafka,以前称为 Kafka Eagle)是一款由国内公司开源的Kafka集群监控系统,可以用来监视kafka集群的broker状态、Topic信息、IO、内存、consumer线程、偏移量等信息,并进行可视化图表展示。独特的KQL还可以通过SQL在线查询kafka中的数据。

二、开始编排部署 EFAK

1)部署 docker

# 安装yum-config-manager配置工具
yum -y install yum-utils

# 建议使用阿里云yum源:(推荐)
#yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

# 安装docker-ce版本
yum install -y docker-ce
# 启动并开机启动
systemctl enable --now docker
docker --version

2)部署 docker-compose

curl -SL https://github.com/docker/compose/releases/download/v2.16.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose

chmod +x /usr/local/bin/docker-compose
docker-compose --version

3)创建自定义docker网络

# 创建
docker network create bigdata

# 查看
docker network ls

4)创建 MySQL 挂载目录

mkdir -pv mysql/{data,logs}

5)编排 docker-compose.yaml 部署

docker-compose.yml

services:
  zookeeper:
    image:  registry.cn-hangzhou.aliyuncs.com/bigdata_cloudnative/efak-zookeeper:3.8.1
    container_name: zookeeper
    restart: always
    environment:
      - ZOOKEEPER_CLIENT_PORT=2181
       # 必须开启 允许匿名登录
      - ALLOW_ANONYMOUS_LOGIN=yes
      - TZ=Asia/Shanghai
    volumes:
      - /etc/localtime:/etc/localtime
    ports:
      - 2181:2181
    networks:
      - bigdata

  kafka:
    image:  registry.cn-hangzhou.aliyuncs.com/bigdata_cloudnative/kafka:3.2.3
    container_name: kafka
    restart: always
    environment:
      - KAFKA_BROKER_ID=1
       # 内部访问
      - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092
       # 外部访问 由于有端口冲突 指定为190092
      - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://192.168.182.110:19092
      - KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
      - ALLOW_PLAINTEXT_LISTENER=yes
       # 是否启用kafka Raft 模式 默认是yes 要给关闭
      - KAFKA_ENABLE_KRAFT=no
      - JMX_PORT=9999
      - TZ=Asia/Shanghai
    volumes:
      - /etc/localtime:/etc/localtime
    ports:
      - 19092:9092
      - 9999:9999
    depends_on:
      - zookeeper
    networks:
      - bigdata


  mysql-kafka:
    image: registry.cn-hangzhou.aliyuncs.com/bigdata_cloudnative/mysql:5.7
    container_name: mysql-kafka
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=123456
      - MYSQL_DATABASE=ke
      - TZ=Asia/Shanghai
    volumes:
      - /etc/localtime:/etc/localtime
      - ./mysql/data:/var/lib/mysql
      - ./mysql/logs:/var/log/mysql
    networks:
      - bigdata
    ports:
      - 13306:3306

  eagle:
    image:  registry.cn-hangzhou.aliyuncs.com/bigdata_cloudnative/kafka-eagle:2.0.3
    container_name: eagle
    environment:
      - EFAK_CLUSTER_ZK_LIST=zookeeper:2181
       # 所有的做时间同步宿主机 要不然会有时间问题
      - TZ=Asia/Shanghai
    volumes:
      - /etc/localtime:/etc/localtime
      - ./system-config.properties:/kafka-eagle/conf/system-config.properties
    depends_on:
      - kafka
    ports:
      - 8048:8048
    networks:
      - bigdata


networks:
  bigdata:
    driver: bridge

配置文件system-config.properties

# 指定zookeeper
######################################
# multi zookeeper & kafka cluster list
######################################
# kafka.eagle.zk.cluster.alias=cluster1,cluster2,cluster3
kafka.eagle.zk.cluster.alias=cluster1
cluster1.zk.list=zookeeper: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=10
######################################
# zk client thread limit
######################################
kafka.zk.limit.size=25
######################################
# kafka eagle webui port
######################################
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=zookeeper
######################################
# kafka metrics, 15 days by default
######################################
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 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.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=
# eagle 默认使用hadoop 存储信息
######################################
# 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
# 我们使用MySQL 进行数据存储
######################################
# kafka mysql jdbc driver address
######################################
kafka.eagle.driver=com.mysql.jdbc.Driver
kafka.eagle.url=jdbc:mysql://192.168.182.110:13306/ke?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
kafka.eagle.username=root
kafka.eagle.password=123456

启动服务

docker-compose -f docker-compose.yml up -d

访问:http://192.168.182.110:8048/,记得更换自己的地址哦!!!

账号/密码:admin/123456

也可以管理多套集群,通过修改EFAK配置文件重启即可。

kafka.eagle.zk.cluster.alias=cluster1,cluster2,cluster3

以上就是关于docker-compose 如何快速部署 EFAK相关的全部内容,希望对你有帮助哦。欢迎持续关注潘子夜个人博客(www.panziye.com),学习愉快哦!


版权声明:本站文章,如无说明,均为本站原创,转载请注明文章来源。如有侵权,请联系博主删除。
本文链接:https://www.panziye.com/back/12437.html
喜欢 (0)
请潘老师喝杯Coffee吧!】
分享 (0)
用户头像
发表我的评论
取消评论
表情 贴图 签到 代码

Hi,您需要填写昵称和邮箱!

  • 昵称【必填】
  • 邮箱【必填】
  • 网址【可选】