美文网首页
docker zookeeper kafka kafka-man

docker zookeeper kafka kafka-man

作者: 黑猫警长1122 | 来源:发表于2022-01-07 16:28 被阅读0次

    mac下通过docker安装kafka

    version: '3'
    services:
      zookeeper:
        image: zookeeper
        ports:
          - "2181:2181"
      kafka:
        image: wurstmeister/kafka
        depends_on: [ zookeeper ]
        ports:
          - "9092:9092"
        environment:
          KAFKA_ADVERTISED_HOST_NAME: 172.16.12.119
          KAFKA_CREATE_TOPICS: "test:1:1"
          KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
        volumes:
          - ~/dockercompose/kafka/docker.sock:/var/run/docker.sock
      kafka-manager:
        image: sheepkiller/kafka-manager
        depends_on: 
          - zookeeper
          - kafka
        ports:
          - "9000:9000"
        environment:
          ZK_HOSTS: zookeeper:2181
    

    将文件保存为compose.yml,从终端进入文件所在文件夹,通过docker启动

    $ docker build
    $ docker up -d
    

    从docker客户端可以看到容器已经启动


    image.png

    访问http://127.0.0.1:9000,add cluster


    image.png
    image.png

    安装完成。

    相关文章

      网友评论

          本文标题:docker zookeeper kafka kafka-man

          本文链接:https://www.haomeiwen.com/subject/ytwjcrtx.html