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

docker compose部署kafka集群

先部署zookeeper集群,启动

参考:docker compose部署zookeeper集群-CSDN博客

再部署kafka集群

networks:
  net:
    external: true

services:


  kafka1:
    restart: always
    image: wurstmeister/kafka:2.13_2.8.1
    container_name: kafka1
    hostname: kafka1
    ports:
      - '9092:9092'
    environment:
      - KAFKA_ZOOKEEPER_CONNECT=zookeeper1:2181,zookeeper2:2182,zookeeper3:2183/kafka
      - KAFKA_BROKER_ID=1      
      - KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092
      - KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://182.92.152.225:9092
      - ALLOW_PLAINTEXT_LISTENER=yes
      - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=3
      - KAFKA_NUM_PARTITIONS=1
    volumes:
      - /etc/localtime:/etc/localtime
      - /home/sumengnan/apache/kafka/kafka1/data:/kafka/kafka-logs-kafka1
      - /home/sumengnan/apache/kafka/kafka1/logs:/opt/kafka/logs
    networks:
      - net


  kafka2:
    restart: always
    image: wurstmeister/kafka:2.13_2.8.1
    container_name: kafka2
    hostname: kafka2
    ports:
      - '9093:9092'
    environment:
      - KAFKA_ZOOKEEPER_CONNECT=zookeeper1:2181,zookeeper2:2182,zookeeper3:2183/kafka
      - KAFKA_BROKER_ID=2      
      - KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092
      - KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://182.92.152.225:9093
      - ALLOW_PLAINTEXT_LISTENER=yes
      - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=3
      - KAFKA_NUM_PARTITIONS=1
    volumes:
      - /etc/localtime:/etc/localtime
      - /home/sumengnan/apache/kafka/kafka2/data:/kafka/kafka-logs-kafka2
      - /home/sumengnan/apache/kafka/kafka2/logs:/opt/kafka/logs
    networks:
      - net


  kafka3:
    restart: always
    image: wurstmeister/kafka:2.13_2.8.1
    container_name: kafka3
    hostname: kafka3
    ports:
      - '9094:9092'
    environment:
      - KAFKA_ZOOKEEPER_CONNECT=zookeeper1:2181,zookeeper2:2182,zookeeper3:2183/kafka
      - KAFKA_BROKER_ID=3      
      - KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092
      - KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://182.92.152.225:9094
      - ALLOW_PLAINTEXT_LISTENER=yes
      - KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=3
      - KAFKA_NUM_PARTITIONS=1
    volumes:
      - /etc/localtime:/etc/localtime
      - /home/sumengnan/apache/kafka/kafka3/data:/kafka/kafka-logs-kafka3
      - /home/sumengnan/apache/kafka/kafka3/logs:/opt/kafka/logs
    networks:
      - net

  kafka-console-ui:
    restart: always
    image: wdkang/kafka-console-ui:v1.0.10
    container_name: kafka-console-ui
    hostname: kafka-console-ui
    ports:
      - '7766:7766'
    volumes:
      - /etc/localtime:/etc/localtime
      - /home/sumengnan/apache/kafka/kafka-console-ui/data:/app/data
      - /home/sumengnan/apache/kafka/kafka-console-ui/log:/app/log
    networks:
      - net

 其中:KAFKA_ADVERTISED_LISTENERS为外网ip地址

kafka-console-ui为kafka的可视化web界面,访问7676端口。


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

相关文章:

  • sqlalchemy-access库操作MS Access
  • Spark Runtime Filter
  • Spring Boot日志处理
  • springboot 跨域配置
  • 【C语言 采集数据 精简排序】
  • [羊城杯 2024]1z_misc
  • Linux -- 死锁、自旋锁
  • Oracle库锁表处理
  • 在Ubuntu下通过Docker部署MySQL服务器
  • 论文分享 | PromptFuzz:用于模糊测试驱动程序生成的提示模糊测试
  • 【Docker】:Docker容器技术
  • SAP B1 认证考试习题 - 解析版(六)
  • ChatGPT-4助力学术论文提升文章逻辑、优化句式与扩充内容等应用技巧解析。附提示词案例
  • 百度贴吧的ip属地什么意思?怎么看ip属地
  • 2024年前端工程师总结
  • 提示词工程教程(零):提示词工程教程简介
  • 【基于语义地图的机器人路径覆盖】Radiant Field-Informed Coverage Planning (RFICP)高斯扩散场轨迹规划算法详解
  • 详细了解Redis分布式存储的常见方案
  • 在虚幻引擎4(UE4)中使用蓝图的详细教程
  • Ungoogled Chromium127编译指南 Linux篇 - 安装Python(四)
  • Quartus In-System Sources and Probes Editor 的使用说明
  • 视觉提示调优:一种高效的Transformer迁移学习新方法 - 仅需1%参数实现超越全量微调的性能
  • css绘制圆并绘制圆的半径
  • Docker部署-WebsiteGuide
  • 低空经济新动力:无人机航测技术的普及与应用
  • 企业赋能是什么意思-国际数字影像产业园解读