1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
| version: '3.5'
services: zookeeper01: image: zookeeper:3.8.4 container_name: zookeeper01 restart: always hostname: zookeeper01 ports: - 2181:2181 environment: TZ: Asia/Shanghai ZOO_MY_ID: 1 ZOO_PORT: 2181 ZOO_4LW_COMMANDS_WHITELIST: ruok ZOO_SERVERS: server.1=zookeeper01:2888:3888;2181 server.2=zookeeper02:2888:3888;2181 server.3=zookeeper03:2888:3888;2181 healthcheck: test: ["CMD", "sh", "-c", "echo ruok | nc localhost 2181 | grep imok"] interval: 30s timeout: 10s retries: 5 start_period: 20s volumes: - /usr/local/zookeeper/zookeeper01/data:/data - /usr/local/zookeeper/zookeeper01/datalog:/datalog networks: - distributed-network
zookeeper02: image: zookeeper:3.8.4 container_name: zookeeper02 restart: always hostname: zookeeper02 ports: - 2182:2181 environment: TZ: Asia/Shanghai ZOO_MY_ID: 2 ZOO_PORT: 2181 ZOO_4LW_COMMANDS_WHITELIST: ruok ZOO_SERVERS: server.1=zookeeper01:2888:3888;2181 server.2=zookeeper02:2888:3888;2181 server.3=zookeeper03:2888:3888;2181 healthcheck: test: ["CMD", "sh", "-c", "echo ruok | nc localhost 2181 | grep imok"] interval: 30s timeout: 10s retries: 5 start_period: 20s volumes: - /usr/local/zookeeper/zookeeper02/data:/data - /usr/local/zookeeper/zookeeper02/datalog:/datalog networks: - distributed-network
zookeeper03: image: zookeeper:3.8.4 container_name: zookeeper03 restart: always hostname: zookeeper03 ports: - 2183:2181 environment: TZ: Asia/Shanghai ZOO_MY_ID: 3 ZOO_PORT: 2181 ZOO_4LW_COMMANDS_WHITELIST: ruok ZOO_SERVERS: server.1=zookeeper01:2888:3888;2181 server.2=zookeeper02:2888:3888;2181 server.3=zookeeper03:2888:3888;2181 healthcheck: test: ["CMD", "sh", "-c", "echo ruok | nc localhost 2181 | grep imok"] interval: 30s timeout: 10s retries: 5 start_period: 20s volumes: - /usr/local/zookeeper/zookeeper03/data:/data - /usr/local/zookeeper/zookeeper03/datalog:/datalog networks: - distributed-network kafka01: image: bitnami/kafka:3.9.0 container_name: kafka01 restart: always hostname: kafka01 ports: - 9093:9093 environment: TZ: Asia/Shanghai KAFKA_CFG_NODE_ID: 1 KAFKA_CFG_LISTENERS: PLAINTEXT://:9093 KAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://192.168.56.112:9093 KAFKA_CFG_ZOOKEEPER_CONNECT: zookeeper01:2181,zookeeper02:2181,zookeeper03:2181/kafka ALLOW_PLAINTEXT_LISTENER: yes healthcheck: test: ["CMD", "kafka-topics.sh", "--bootstrap-server", "kafka01:9093,kafka02:9094,kafka03:9095", "--list"] interval: 30s timeout: 15s retries: 5 start_period: 30s volumes: - /usr/local/kafka/kafka01:/bitnami/kafka depends_on: zookeeper01: condition: service_healthy zookeeper02: condition: service_healthy zookeeper03: condition: service_healthy networks: - distributed-network
kafka02: image: bitnami/kafka:3.9.0 container_name: kafka02 restart: always hostname: kafka02 ports: - 9094:9094 environment: TZ: Asia/Shanghai KAFKA_CFG_NODE_ID: 2 KAFKA_CFG_LISTENERS: PLAINTEXT://:9094 KAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://192.168.56.112:9094 KAFKA_CFG_ZOOKEEPER_CONNECT: zookeeper01:2181,zookeeper02:2181,zookeeper03:2181/kafka ALLOW_PLAINTEXT_LISTENER: yes healthcheck: test: ["CMD", "kafka-topics.sh", "--bootstrap-server", "kafka01:9093,kafka02:9094,kafka03:9095", "--list"] interval: 30s timeout: 15s retries: 5 start_period: 30s volumes: - /usr/local/kafka/kafka02:/bitnami/kafka depends_on: zookeeper01: condition: service_healthy zookeeper02: condition: service_healthy zookeeper03: condition: service_healthy networks: - distributed-network
kafka03: image: bitnami/kafka:3.9.0 container_name: kafka03 restart: always hostname: kafka03 ports: - 9095:9095 environment: TZ: Asia/Shanghai KAFKA_CFG_NODE_ID: 3 KAFKA_CFG_LISTENERS: PLAINTEXT://:9095 KAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://192.168.56.112:9095 KAFKA_CFG_ZOOKEEPER_CONNECT: zookeeper01:2181,zookeeper02:2181,zookeeper03:2181/kafka ALLOW_PLAINTEXT_LISTENER: yes healthcheck: test: ["CMD", "kafka-topics.sh", "--bootstrap-server", "kafka01:9093,kafka02:9094,kafka03:9095", "--list"] interval: 30s timeout: 15s retries: 5 start_period: 30s volumes: - /usr/local/kafka/kafka03:/bitnami/kafka depends_on: zookeeper01: condition: service_healthy zookeeper02: condition: service_healthy zookeeper03: condition: service_healthy networks: - distributed-network
networks: distributed-network: driver: bridge
|