当前位置: 首页 > article >正文

docker-compose部署kafka 3.3.1 kraft

一、服务器:

节点1:10.1.1.165
节点2:10.1.1.164
节点3:10.1.1.169

二、添加环境地址解析

vim /etc/hosts
kafka1 10.1.1.165
kafka2 10.1.1.164
kafka3 10.1.1.169

三、节点配置
节点1

version: "3"
services:
  kafka1:
    image: 'bitnami/kafka:3.3.1'
    container_name: kafka11
    restart: always
    user: root
    ports:
      - 9192:9092
      - 9193:9093
    environment:
      - KAFKA_ENABLE_KRAFT=yes
      - KAFKA_CFG_PROCESS_ROLES=broker,controller
      - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER
      - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093
      - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
      - KAFKA_KRAFT_CLUSTER_ID=xxxxxxxxxxxxxxxxxxxxxx
      - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=1@kafka1:9193,2@kafka2:9293,3@kafka3:9393
      - ALLOW_PLAINTEXT_LISTENER=yes
      - KAFKA_HEAP_OPTS=-Xmx1024M -Xms512M 
      - KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE=false
      - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://10.1.1.165:9192
      - KAFKA_BROKER_ID=1
      - KAFKA_CFG_NODE_ID=1
      - TZ=Asia/Shanghai
    volumes:
      - /kafka/kraft:/bitnami/kafka
      - /etc/localtime:/etc/localtime:ro
      - /etc/hosts:/etc/hosts
  kafka-ui:
    image: provectuslabs/kafka-ui:latest
    #    network_mode: heilansc-product
    container_name: kafka-ui
    restart: always
    ports:
      - 9091:8080
    volumes:
      - /etc/localtime:/etc/localtime
      - /etc/hosts:/etc/hosts
    environment:
      # 集群名称
      - KAFKA_CLUSTERS_0_NAME=local
      # 集群地址
      - KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS=kafka1:9192,kafka2:9292,kafka3:9392
networks:
  default:
    external: true
    name: product

节点2

version: "3"
services:
  kafka2:
    image: 'bitnami/kafka:3.3.1'
    container_name: kafka22
    restart: always
    user: root
    ports:
      - 9292:9092
      - 9293:9093
    environment:
      - KAFKA_ENABLE_KRAFT=yes
      - KAFKA_CFG_PROCESS_ROLES=broker,controller
      - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER
      - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093
      - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
      - KAFKA_KRAFT_CLUSTER_ID=xxxxxxxxxxxxxxxxxxxxxx
      - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=1@kafka1:9193,2@kafka2:9293,3@kafka3:9393
      - ALLOW_PLAINTEXT_LISTENER=yes
      - KAFKA_HEAP_OPTS=-Xmx1024M -Xms512M 
      - KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE=false
      - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://10.1.1.164:9292
      - KAFKA_BROKER_ID=2
      - KAFKA_CFG_NODE_ID=2
      - TZ=Asia/Shanghai
    volumes:
      - /kafka/kraft:/bitnami/kafka
      - /etc/localtime:/etc/localtime:ro
      - /etc/hosts:/etc/hosts
networks:
  default:
    external: true
    name: product

节点3

version: "3"
services:
  kafka3:
    image: 'bitnami/kafka:3.3.1'
    container_name: kafka33
    restart: always
    user: root
    ports:
      - 9392:9092
      - 9393:9093
    environment:
      - KAFKA_ENABLE_KRAFT=yes
      - KAFKA_CFG_PROCESS_ROLES=broker,controller
      - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER
      - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093
      - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
      - KAFKA_KRAFT_CLUSTER_ID=xxxxxxxxxxxxxxxxxxxxxx
      - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=1@kafka1:9193,2@kafka2:9293,3@kafka3:9393
      - ALLOW_PLAINTEXT_LISTENER=yes
      - KAFKA_HEAP_OPTS=-Xmx1024M -Xms512M 
      - KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE=false
      - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://10.1.1.169:9392
      - KAFKA_BROKER_ID=3
      - KAFKA_CFG_NODE_ID=3
      - TZ=Asia/Shanghai
    volumes:
      - /kafka/kraft:/bitnami/kafka
      - /etc/localtime:/etc/localtime:ro
      - /etc/hosts:/etc/hosts
networks:
  default:
    external: true
    name: product


http://www.kler.cn/a/503239.html

相关文章:

  • 如何选择Ubuntu版本
  • R.swift库的详细用法
  • Windows核心编程—匿名管道双向通信
  • 5、波分复用 WDM
  • Java100道面试题
  • 图解Git——分支的新建与合并《Pro Git》
  • 计算机网络之---DNS协议
  • 《使用人工智能心脏磁共振成像筛查和诊断心血管疾病》论文精读
  • 【STM32-学习笔记-4-】PWM、输入捕获(PWMI)
  • 基于微信小程序的汽车销售系统的设计与实现springboot+论文源码调试讲解
  • IntelliJ IDEA Type Hierarchy Scope Pattern 学习指南
  • qt 窗口(window/widget)绘制/渲染顺序 QPainter QPaintDevice Qpainter渲染 失效 无效 原因
  • 【Python项目】图像信息隐藏技术的实现
  • Python入门10:高阶函数
  • MERN全栈脚手架(MongoDB、Express、React、Node)与Yeoman详解
  • 力扣152. 乘积最大子数组
  • pytorch nn.Dropout类介绍
  • 04.计算机体系三层结构与优化(操作系统、计算机网络、)
  • Vue JavaScript 小写数字金额转换成大写汉字(附编程思路)
  • 简识MySQL的InnoDB Locking锁的分类
  • ue5 设置角色属性(生命值,蓝条值,能量值)c++
  • 基于WebRTC实现音视频通话
  • day01-HTML-CSS——基础标签样式表格标签表单标签
  • 斯坦福大学李飞飞教授团队ARCap: 利用增强现实反馈收集高质量的人类示教以用于机器人学习
  • 安装软件缺少msvcp110.dll怎么办?出现dll丢失的解决方法
  • LeetCode热题100(哈希篇)