1 頁 (共 1 頁)

kafka

發表於 : 2018-05-29 14:52:31
yehlu
https://cutejaneii.wordpress.com/2017/0 ... %E4%B8%8A/

代碼: 選擇全部

version: '2'
services:
 kafka1:
  image: wurstmeister/kafka
  depends_on:
  - zoo1
  - zoo2
  - zoo3
  ports:
  - "9092:9092"
  environment:
    KAFKA_LOG_DIRS: /kafka
    KAFKA_BROKER_ID: 1
    KAFKA_CREATE_TOPICS: test:6:1
    KAFKA_ADVERTISED_HOST_NAME: 192.168.0.1
    KAFKA_ADVERTISED_PORT: 9092
    KAFKA_ZOOKEEPER_CONNECT: zoo1:2181,zoo2:2181,zoo3:2181

 kafka2:
  image: wurstmeister/kafka
  depends_on:
  - zoo1
  - zoo2
  - zoo3
  ports:
  - "9093:9092"
  environment:
    KAFKA_LOG_DIRS: /kafka
    KAFKA_BROKER_ID: 2
    KAFKA_ADVERTISED_HOST_NAME: 192.168.0.1
    KAFKA_ADVERTISED_PORT: 9093
    KAFKA_ZOOKEEPER_CONNECT: zoo1:2181,zoo2:2181,zoo3:2181

 kafka3:
  image: wurstmeister/kafka
  depends_on:
  - zoo1
  - zoo2
  - zoo3
  ports:
  - "9094:9092"
  environment:
    KAFKA_LOG_DIRS: /kafka
    KAFKA_BROKER_ID: 3
    KAFKA_ADVERTISED_HOST_NAME: 192.168.0.1
    KAFKA_ADVERTISED_PORT: 9094
    KAFKA_ZOOKEEPER_CONNECT: zoo1:2181,zoo2:2181,zoo3:2181

 zoo1:
  image: zookeeper:latest
  environment:
    ZOO_MY_ID: 1
  #SERVERS: zoo1,zoo2,zoo3
  ports:
  - "2181:2181"
  - "2888"
  - "3888"

 zoo2:
  image: zookeeper:latest
  environment:
    ZOO_MY_ID: 2
  #SERVERS: zoo1,zoo2,zoo3
  ports:
  - "2182:2181"
  - "2888"
  - "3888"
 
 zoo3:
  image: zookeeper:latest
  environment:
    ZOO_MY_ID: 3
  #SERVERS: zoo1,zoo2,zoo3
  ports:
  - "2183:2181"
  - "2888"
  - "3888"