docker-zk-kafka

docker-zk-kafka

  1. docker-compose.yml
version: '2'
services:
  zookeeper:
    image: wurstmeister/zookeeper
    ports:
      - "2181:2181"
  kafka:
    image: wurstmeister/kafka:2.13-2.7.0
    ports:
      - "9092:9092"
    environment:
      KAFKA_ADVERTISED_HOST_NAME: 192.168.113.104
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_CREATE_TOPICS: "test:1:3"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
   kafka:
    image: wurstmeister/kafka:2.13-2.7.0
    ports:
      - "9093:9092"
  1. 修改KAFKA_ADVERTISED_HOST_NAME为自己主机的IP
docker-compose up -d
posted @ 2023-04-03 11:07  edclol  阅读(13)  评论(0编辑  收藏  举报