github.com/pingcap/ticdc@v0.0.0-20220526033649-485a10ef2652/docker-compose-canal.yml (about) 1 --- 2 version: '2.1' 3 4 services: 5 controller: 6 image: ticdc:latest 7 build: 8 context: . 9 dockerfile: ./Dockerfile 10 volumes: 11 - /data 12 - ./docker/logs:/logs 13 - ./docker/config:/config 14 command: 15 - /bin/bash 16 - -c 17 - /usr/bin/tail -f /dev/null 18 depends_on: 19 - "upstream-pd" 20 - "kafka" 21 - "capturer0" 22 - "capturer1" 23 - "capturer2" 24 restart: on-failure 25 26 capturer0: 27 image: ticdc:latest 28 build: 29 context: . 30 dockerfile: ./Dockerfile 31 volumes: 32 - /data 33 - ./docker/logs:/logs 34 entrypoint: "/cdc server" 35 command: 36 - --addr=0.0.0.0:8300 37 - --pd=http://upstream-pd:2379 38 - --log-file=/logs/capturer0.log 39 - --advertise-addr=capturer0:8300 40 - --log-level=debug 41 depends_on: 42 - "upstream-tidb" 43 - "downstream-tidb" 44 - "kafka" 45 restart: on-failure 46 47 capturer1: 48 image: ticdc:latest 49 build: 50 context: . 51 dockerfile: ./Dockerfile 52 volumes: 53 - /data 54 - ./docker/logs:/logs 55 entrypoint: "/cdc server" 56 command: 57 - --addr=0.0.0.0:8300 58 - --pd=http://upstream-pd:2379 59 - --log-file=/logs/capturer1.log 60 - --advertise-addr=capturer1:8300 61 - --log-level=debug 62 depends_on: 63 - "upstream-tidb" 64 - "downstream-tidb" 65 - "kafka" 66 restart: on-failure 67 68 capturer2: 69 image: ticdc:latest 70 build: 71 context: . 72 dockerfile: ./Dockerfile 73 volumes: 74 - /data 75 - ./docker/logs:/logs 76 entrypoint: "/cdc server" 77 command: 78 - --addr=0.0.0.0:8300 79 - --pd=http://upstream-pd:2379 80 - --log-file=/logs/capturer2.log 81 - --advertise-addr=capturer2:8300 82 - --log-level=debug 83 depends_on: 84 - "upstream-tidb" 85 - "downstream-tidb" 86 - "kafka" 87 restart: on-failure 88 89 upstream-pd: 90 image: pingcap/pd:release-4.0-nightly 91 ports: 92 - "2379:2379" 93 volumes: 94 - ./docker/config/pd.toml:/pd.toml:ro 95 - /data 96 - ./docker/logs:/logs 97 command: 98 - --name=upstream-pd 99 - --client-urls=http://0.0.0.0:2379 100 - --peer-urls=http://0.0.0.0:2380 101 - --advertise-client-urls=http://upstream-pd:2379 102 - --advertise-peer-urls=http://upstream-pd:2380 103 - --initial-cluster=upstream-pd=http://upstream-pd:2380 104 - --data-dir=/data/upstream-pd 105 - --config=/pd.toml 106 - --log-file=/logs/upstream-pd.log 107 - -L=debug 108 restart: on-failure 109 110 upstream-tikv0: 111 image: pingcap/tikv:release-4.0-nightly 112 volumes: 113 - ./docker/config/tikv.toml:/tikv.toml:ro 114 - /data 115 - ./docker/logs:/logs 116 command: 117 - --addr=0.0.0.0:20160 118 - --advertise-addr=upstream-tikv0:20160 119 - --data-dir=/data/upstream-tikv0 120 - --pd=upstream-pd:2379 121 - --config=/tikv.toml 122 - --log-file=/logs/upstream-tikv0.log 123 - --log-level=debug 124 depends_on: 125 - "upstream-pd" 126 restart: on-failure 127 128 upstream-tikv1: 129 image: pingcap/tikv:release-4.0-nightly 130 volumes: 131 - ./docker/config/tikv.toml:/tikv.toml:ro 132 - /data 133 - ./docker/logs:/logs 134 command: 135 - --addr=0.0.0.0:20160 136 - --advertise-addr=upstream-tikv1:20160 137 - --data-dir=/data/upstream-tikv1 138 - --pd=upstream-pd:2379 139 - --config=/tikv.toml 140 - --log-file=/logs/upstream-tikv1.log 141 - --log-level=debug 142 depends_on: 143 - "upstream-pd" 144 restart: on-failure 145 146 upstream-tikv2: 147 image: pingcap/tikv:release-4.0-nightly 148 volumes: 149 - ./docker/config/tikv.toml:/tikv.toml:ro 150 - /data 151 - ./docker/logs:/logs 152 command: 153 - --addr=0.0.0.0:20160 154 - --advertise-addr=upstream-tikv2:20160 155 - --data-dir=/data/upstream-tikv2 156 - --pd=upstream-pd:2379 157 - --config=/tikv.toml 158 - --log-file=/logs/upstream-tikv2.log 159 - --log-level=debug 160 depends_on: 161 - "upstream-pd" 162 restart: on-failure 163 164 upstream-tidb: 165 image: pingcap/tidb:release-4.0-nightly 166 ports: 167 - "4000:4000" 168 - "10080:10080" 169 volumes: 170 - ./docker/config/tidb.toml:/tidb.toml:ro 171 - ./docker/logs:/logs 172 command: 173 - --store=tikv 174 - --path=upstream-pd:2379 175 - --config=/tidb.toml 176 - --log-file=/logs/upstream-tidb.log 177 - --advertise-address=upstream-tidb 178 - -L=debug 179 depends_on: 180 - "upstream-tikv0" 181 - "upstream-tikv1" 182 - "upstream-tikv2" 183 restart: on-failure 184 185 downstream-pd: 186 image: pingcap/pd:release-4.0-nightly 187 ports: 188 - "3379:2379" 189 volumes: 190 - ./docker/config/pd.toml:/pd.toml:ro 191 - /data 192 - ./docker/logs:/logs 193 command: 194 - --name=downstream-pd 195 - --client-urls=http://0.0.0.0:2379 196 - --peer-urls=http://0.0.0.0:2380 197 - --advertise-client-urls=http://downstream-pd:2379 198 - --advertise-peer-urls=http://downstream-pd:2380 199 - --initial-cluster=downstream-pd=http://downstream-pd:2380 200 - --data-dir=/data/downstream-pd 201 - --config=/pd.toml 202 - --log-file=/logs/downstream-pd.log 203 - -L=debug 204 restart: on-failure 205 206 downstream-tikv0: 207 image: pingcap/tikv:release-4.0-nightly 208 volumes: 209 - ./docker/config/tikv.toml:/tikv.toml:ro 210 - /data 211 - ./docker/logs:/logs 212 command: 213 - --addr=0.0.0.0:20160 214 - --advertise-addr=downstream-tikv0:20160 215 - --data-dir=/data/downstream-tikv0 216 - --pd=downstream-pd:2379 217 - --config=/tikv.toml 218 - --log-file=/logs/downstream-tikv0.log 219 - --log-level=debug 220 depends_on: 221 - "downstream-pd" 222 restart: on-failure 223 224 downstream-tikv1: 225 image: pingcap/tikv:release-4.0-nightly 226 volumes: 227 - ./docker/config/tikv.toml:/tikv.toml:ro 228 - /data 229 - ./docker/logs:/logs 230 command: 231 - --addr=0.0.0.0:20160 232 - --advertise-addr=downstream-tikv1:20160 233 - --data-dir=/data/downstream-tikv1 234 - --pd=downstream-pd:2379 235 - --config=/tikv.toml 236 - --log-file=/logs/downstream-tikv1.log 237 - --log-level=debug 238 depends_on: 239 - "downstream-pd" 240 restart: on-failure 241 242 downstream-tikv2: 243 image: pingcap/tikv:release-4.0-nightly 244 volumes: 245 - ./docker/config/tikv.toml:/tikv.toml:ro 246 - /data 247 - ./docker/logs:/logs 248 command: 249 - --addr=0.0.0.0:20160 250 - --advertise-addr=downstream-tikv2:20160 251 - --data-dir=/data/downstream-tikv2 252 - --pd=downstream-pd:2379 253 - --config=/tikv.toml 254 - --log-file=/logs/downstream-tikv2.log 255 - --log-level=debug 256 depends_on: 257 - "downstream-pd" 258 restart: on-failure 259 260 downstream-tidb: 261 image: pingcap/tidb:release-4.0-nightly 262 ports: 263 - "5000:4000" 264 - "20080:10080" 265 volumes: 266 - ./docker/config/tidb.toml:/tidb.toml:ro 267 - ./docker/logs:/logs 268 command: 269 - --store=tikv 270 - --path=downstream-pd:2379 271 - --config=/tidb.toml 272 - --log-file=/logs/downstream-tidb.log 273 - --advertise-address=downstream-tidb 274 - -L=debug 275 depends_on: 276 - "downstream-tikv0" 277 - "downstream-tikv1" 278 - "downstream-tikv2" 279 restart: on-failure 280 281 # The rest of the file is adapted from https://github.com/confluentinc/demo-scene/blob/master/connect-jdbc/docker-compose.yml 282 283 zookeeper: 284 image: confluentinc/cp-zookeeper:5.5.1 285 container_name: zookeeper 286 environment: 287 ZOOKEEPER_CLIENT_PORT: 2181 288 ZOOKEEPER_TICK_TIME: 2000 289 290 kafka: 291 image: confluentinc/cp-enterprise-kafka:5.5.1 292 container_name: kafka 293 depends_on: 294 - "zookeeper" 295 ports: 296 # Exposes 9092 for external connections to the broker 297 # Use kafka:29092 for connections internal on the docker network 298 # See https://rmoff.net/2018/08/02/kafka-listeners-explained/ for details 299 - 9092:9092 300 environment: 301 KAFKA_BROKER_ID: 1 302 KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 303 KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT 304 KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT 305 KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://kafka:9092 306 KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true" 307 KAFKA_METRIC_REPORTERS: io.confluent.metrics.reporter.ConfluentMetricsReporter 308 KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 309 KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 100 310 CONFLUENT_METRICS_REPORTER_BOOTSTRAP_SERVERS: kafka:29092 311 CONFLUENT_METRICS_REPORTER_ZOOKEEPER_CONNECT: zookeeper:2181 312 CONFLUENT_METRICS_REPORTER_TOPIC_REPLICAS: 1 313 CONFLUENT_METRICS_ENABLE: 'true' 314 CONFLUENT_SUPPORT_CUSTOMER_ID: 'anonymous' 315 316 canal-adapter: 317 image: canal-adapter:latest 318 build: 319 context: ./scripts/canal/docker/ 320 dockerfile: ./Dockerfile 321 ports: 322 - 8081:8081 323 volumes: 324 - ./docker/logs:/root/logs 325 environment: 326 KAFKA_SERVER: kafka:9092 327 ZOOKEEPER_SERVER: zookeeper:2181 328 DB_NAME: testdb 329 DOWNSTREAM_DB_HOST: downstream-tidb 330 DOWNSTREAM_DB_PORT: 4000 331 USE_FLAT_MESSAGE: ${USE_FLAT_MESSAGE} 332 depends_on: 333 - "zookeeper" 334 - "kafka" 335 - "upstream-tidb" 336 - "downstream-tidb" 337 restart: on-failure