forked from pingcap/tiflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose-canal.yml
343 lines (325 loc) · 8.89 KB
/
docker-compose-canal.yml
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
---
version: '2.1'
services:
controller:
image: ticdc:latest
build:
context: .
dockerfile: ./Dockerfile
volumes:
- /data
- ./docker/logs:/logs
- ./docker/config:/config
command:
- /bin/bash
- -c
- /usr/bin/tail -f /dev/null
depends_on:
- "upstream-pd"
- "kafka"
- "capturer0"
- "capturer1"
- "capturer2"
restart: on-failure
capturer0:
image: ticdc:latest
build:
context: .
dockerfile: ./Dockerfile
volumes:
- /data
- ./docker/logs:/logs
ports:
- "8300:8300"
entrypoint: "/cdc server"
command:
- --addr=0.0.0.0:8300
- --pd=http://upstream-pd:2379
- --log-file=/logs/capturer0.log
- --advertise-addr=capturer0:8300
- --log-level=debug
depends_on:
- "upstream-tidb"
- "downstream-tidb"
- "kafka"
restart: on-failure
capturer1:
image: ticdc:latest
build:
context: .
dockerfile: ./Dockerfile
volumes:
- /data
- ./docker/logs:/logs
ports:
- "8301:8300"
entrypoint: "/cdc server"
command:
- --addr=0.0.0.0:8300
- --pd=http://upstream-pd:2379
- --log-file=/logs/capturer1.log
- --advertise-addr=capturer1:8300
- --log-level=debug
depends_on:
- "upstream-tidb"
- "downstream-tidb"
- "kafka"
restart: on-failure
capturer2:
image: ticdc:latest
build:
context: .
dockerfile: ./Dockerfile
volumes:
- /data
- ./docker/logs:/logs
ports:
- "8302:8300"
entrypoint: "/cdc server"
command:
- --addr=0.0.0.0:8300
- --pd=http://upstream-pd:2379
- --log-file=/logs/capturer2.log
- --advertise-addr=capturer2:8300
- --log-level=debug
depends_on:
- "upstream-tidb"
- "downstream-tidb"
- "kafka"
restart: on-failure
upstream-pd:
image: pingcap/pd:nightly
ports:
- "2379:2379"
volumes:
- ./docker/config/pd.toml:/pd.toml:ro
- /data
- ./docker/logs:/logs
command:
- --name=upstream-pd
- --client-urls=http://0.0.0.0:2379
- --peer-urls=http://0.0.0.0:2380
- --advertise-client-urls=http://upstream-pd:2379
- --advertise-peer-urls=http://upstream-pd:2380
- --initial-cluster=upstream-pd=http://upstream-pd:2380
- --data-dir=/data/upstream-pd
- --config=/pd.toml
- --log-file=/logs/upstream-pd.log
- -L=debug
restart: on-failure
upstream-tikv0:
image: pingcap/tikv:nightly
volumes:
- ./docker/config/tikv.toml:/tikv.toml:ro
- /data
- ./docker/logs:/logs
command:
- --addr=0.0.0.0:20160
- --advertise-addr=upstream-tikv0:20160
- --data-dir=/data/upstream-tikv0
- --pd=upstream-pd:2379
- --config=/tikv.toml
- --log-file=/logs/upstream-tikv0.log
- --log-level=debug
depends_on:
- "upstream-pd"
restart: on-failure
upstream-tikv1:
image: pingcap/tikv:nightly
volumes:
- ./docker/config/tikv.toml:/tikv.toml:ro
- /data
- ./docker/logs:/logs
command:
- --addr=0.0.0.0:20160
- --advertise-addr=upstream-tikv1:20160
- --data-dir=/data/upstream-tikv1
- --pd=upstream-pd:2379
- --config=/tikv.toml
- --log-file=/logs/upstream-tikv1.log
- --log-level=debug
depends_on:
- "upstream-pd"
restart: on-failure
upstream-tikv2:
image: pingcap/tikv:nightly
volumes:
- ./docker/config/tikv.toml:/tikv.toml:ro
- /data
- ./docker/logs:/logs
command:
- --addr=0.0.0.0:20160
- --advertise-addr=upstream-tikv2:20160
- --data-dir=/data/upstream-tikv2
- --pd=upstream-pd:2379
- --config=/tikv.toml
- --log-file=/logs/upstream-tikv2.log
- --log-level=debug
depends_on:
- "upstream-pd"
restart: on-failure
upstream-tidb:
image: pingcap/tidb:nightly
ports:
- "4000:4000"
- "10080:10080"
volumes:
- ./docker/config/tidb.toml:/tidb.toml:ro
- ./docker/logs:/logs
command:
- --store=tikv
- --path=upstream-pd:2379
- --config=/tidb.toml
- --log-file=/logs/upstream-tidb.log
- --advertise-address=upstream-tidb
- -L=debug
depends_on:
- "upstream-tikv0"
- "upstream-tikv1"
- "upstream-tikv2"
restart: on-failure
downstream-pd:
image: pingcap/pd:nightly
ports:
- "3379:2379"
volumes:
- ./docker/config/pd.toml:/pd.toml:ro
- /data
- ./docker/logs:/logs
command:
- --name=downstream-pd
- --client-urls=http://0.0.0.0:2379
- --peer-urls=http://0.0.0.0:2380
- --advertise-client-urls=http://downstream-pd:2379
- --advertise-peer-urls=http://downstream-pd:2380
- --initial-cluster=downstream-pd=http://downstream-pd:2380
- --data-dir=/data/downstream-pd
- --config=/pd.toml
- --log-file=/logs/downstream-pd.log
- -L=debug
restart: on-failure
downstream-tikv0:
image: pingcap/tikv:nightly
volumes:
- ./docker/config/tikv.toml:/tikv.toml:ro
- /data
- ./docker/logs:/logs
command:
- --addr=0.0.0.0:20160
- --advertise-addr=downstream-tikv0:20160
- --data-dir=/data/downstream-tikv0
- --pd=downstream-pd:2379
- --config=/tikv.toml
- --log-file=/logs/downstream-tikv0.log
- --log-level=debug
depends_on:
- "downstream-pd"
restart: on-failure
downstream-tikv1:
image: pingcap/tikv:nightly
volumes:
- ./docker/config/tikv.toml:/tikv.toml:ro
- /data
- ./docker/logs:/logs
command:
- --addr=0.0.0.0:20160
- --advertise-addr=downstream-tikv1:20160
- --data-dir=/data/downstream-tikv1
- --pd=downstream-pd:2379
- --config=/tikv.toml
- --log-file=/logs/downstream-tikv1.log
- --log-level=debug
depends_on:
- "downstream-pd"
restart: on-failure
downstream-tikv2:
image: pingcap/tikv:nightly
volumes:
- ./docker/config/tikv.toml:/tikv.toml:ro
- /data
- ./docker/logs:/logs
command:
- --addr=0.0.0.0:20160
- --advertise-addr=downstream-tikv2:20160
- --data-dir=/data/downstream-tikv2
- --pd=downstream-pd:2379
- --config=/tikv.toml
- --log-file=/logs/downstream-tikv2.log
- --log-level=debug
depends_on:
- "downstream-pd"
restart: on-failure
downstream-tidb:
image: pingcap/tidb:nightly
ports:
- "5000:4000"
- "20080:10080"
volumes:
- ./docker/config/tidb.toml:/tidb.toml:ro
- ./docker/logs:/logs
command:
- --store=tikv
- --path=downstream-pd:2379
- --config=/tidb.toml
- --log-file=/logs/downstream-tidb.log
- --advertise-address=downstream-tidb
- -L=debug
depends_on:
- "downstream-tikv0"
- "downstream-tikv1"
- "downstream-tikv2"
restart: on-failure
# The rest of the file is adapted from https://github.com/confluentinc/demo-scene/blob/master/connect-jdbc/docker-compose.yml
zookeeper:
image: confluentinc/cp-zookeeper:5.5.1
container_name: zookeeper
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
kafka:
image: confluentinc/cp-enterprise-kafka:5.5.1
container_name: kafka
depends_on:
- "zookeeper"
ports:
# Exposes 9092 for external connections to the broker
# Use kafka:29092 for connections internal on the docker network
# See https://rmoff.net/2018/08/02/kafka-listeners-explained/ for details
- 9092:9092
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:29092,PLAINTEXT_HOST://kafka:9092
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
KAFKA_METRIC_REPORTERS: io.confluent.metrics.reporter.ConfluentMetricsReporter
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 100
CONFLUENT_METRICS_REPORTER_BOOTSTRAP_SERVERS: kafka:29092
CONFLUENT_METRICS_REPORTER_ZOOKEEPER_CONNECT: zookeeper:2181
CONFLUENT_METRICS_REPORTER_TOPIC_REPLICAS: 1
CONFLUENT_METRICS_ENABLE: 'true'
CONFLUENT_SUPPORT_CUSTOMER_ID: 'anonymous'
canal-adapter:
image: canal-adapter:latest
build:
context: ./scripts/canal/docker/
dockerfile: ./Dockerfile
ports:
- 8081:8081
volumes:
- ./docker/logs:/root/logs
environment:
KAFKA_SERVER: kafka:9092
ZOOKEEPER_SERVER: zookeeper:2181
DB_NAME: testdb
DOWNSTREAM_DB_HOST: downstream-tidb
DOWNSTREAM_DB_PORT: 4000
USE_FLAT_MESSAGE: ${USE_FLAT_MESSAGE}
depends_on:
- "zookeeper"
- "kafka"
- "upstream-tidb"
- "downstream-tidb"
restart: on-failure