zoukankan      html  css  js  c++  java
  • docker 搭建kafka集群(入门版)

    1.环境

    docker, docker-compose

    2.zk-kafka.yml

    version: '3'
    services:
      zoo1:
        image: zookeeper:3.4.14
        restart: unless-stopped
        hostname: zoo1
        ports:
          - "2181:2181"
        container_name: zookeeper
      kafka1:
        image: wurstmeister/kafka
        ports:
          - "9092:9092"
        environment:
          KAFKA_ADVERTISED_HOST_NAME: 你的宿主机IP                     ## 修改:宿主机IP
          KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://宿主机IP:9092    ## 修改:宿主机IP
          KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181"
          KAFKA_ADVERTISED_PORT: 9092
          KAFKA_BROKER_ID: 1
          KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
        depends_on:
          - zoo1
        container_name: kafka1
    
      kafka2:
        image: wurstmeister/kafka
        ports:
          - "9093:9092"
        environment:
          KAFKA_ADVERTISED_HOST_NAME: 宿主机IP                    ## 修改:宿主机IP
          KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://宿主机IP:9093   ## 修改:宿主机IP
          KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181"
          KAFKA_ADVERTISED_PORT: 9093
          KAFKA_BROKER_ID: 2
          KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
        depends_on:
          - zoo1
        container_name: kafka2
      kafka-manager:
        image: sheepkiller/kafka-manager              ## 镜像:开源的web管理kafka集群的界面
        environment:
            ZK_HOSTS: 宿主机IP                   ## 修改:宿主机IP
        ports:
          - "9000:9000"                               ## 暴露端口

    3.启动

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

    4.查看服务状态

    docker-compose -f zk-kafka.yml ps

    人生如修仙,岂是一日间。何时登临顶,上善若水前。
  • 相关阅读:
    鼠标拖动DIV移动
    JS中事件&对象
    响应式与弹性布局
    JS中的变量和输入输出
    JS中的运算符&JS中的分支结构
    HTML基本标签
    CSS基础语法
    JS中循环结构&函数
    String 二
    StringBuffer
  • 原文地址:https://www.cnblogs.com/f-society/p/13949003.html
Copyright © 2011-2022 走看看