docker-compose部署kafka

docker-compose部署kafka介绍如下:

编写docker-compose.yml文件,将文件中IP修改为本机ip,docker-compose.yml文件内容如下:

version: '2'
services:
  zookeeper:
    image: wurstmeister/zookeeper
    ports:
      - "2181:2181"
  kafka1:
    image: wurstmeister/kafka
    ports:
      - "9092:9092"
    depends_on:
      - zookeeper
    environment:
      KAFKA_ADVERTISED_HOST_NAME: 192.168.1.128
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_delete_topic_enable: 'true'
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
  kafka2:
    image: wurstmeister/kafka
    ports:
      - "9093:9092"
    depends_on:
      - zookeeper
    environment:
      KAFKA_ADVERTISED_HOST_NAME: 192.168.1.128
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_delete_topic_enable: 'true'
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
  kafka3:
    image: wurstmeister/kafka
    ports:
      - "9094:9092"
    depends_on:
      - zookeeper
    environment:
      KAFKA_ADVERTISED_HOST_NAME: 192.168.1.128
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_delete_topic_enable: 'true'
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

进入docker-compose.yml文件所在目录,执行如下命令

docker-compose up

问题:kafka1_1     | [2018-10-10 02:34:17,680] WARN [Controller id=1, targetBrokerId=1] Connection to node 1 could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)

 

你可能感兴趣的:(大数据)