forked from pingcap/tiflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose-avro.yml
390 lines (370 loc) · 11.2 KB
/
docker-compose-avro.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
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
---
version: '2.1'
services:
controller:
image: ticdc:latest
build:
context: .
dockerfile: ./Dockerfile.development
volumes:
- /data
- ./docker/logs:/logs
- ./docker/config:/config
command:
- /usr/bin/socat
- -v
- tcp-l:1234,fork
- exec:'/bin/cat'
ports:
- "1234:1234"
depends_on:
- "upstream-pd"
- "schema-registry"
- "kafka-connect-01"
- "kafka"
- "capturer0"
- "capturer1"
- "capturer2"
restart: on-failure
capturer0:
image: ticdc:latest
build:
context: .
dockerfile: ./Dockerfile.development
volumes:
- /data
- ./docker/logs:/logs
entrypoint: "/cdc server"
command:
- --addr=0.0.0.0:8300
- --pd=http://upstream-pd:2379
- --log-file=/logs/capturer0.log
- --log-level=debug
- --advertise-addr=capturer0:8300
- --tz=${CDC_TIME_ZONE:-SYSTEM}
depends_on:
- "upstream-tidb"
- "downstream-tidb"
- "kafka"
restart: on-failure
capturer1:
image: ticdc:latest
build:
context: .
dockerfile: ./Dockerfile.development
volumes:
- /data
- ./docker/logs:/logs
entrypoint: "/cdc server"
command:
- --addr=0.0.0.0:8300
- --pd=http://upstream-pd:2379
- --log-file=/logs/capturer1.log
- --log-level=debug
- --advertise-addr=capturer1:8300
- --tz=${CDC_TIME_ZONE:-SYSTEM}
depends_on:
- "upstream-tidb"
- "downstream-tidb"
- "kafka"
restart: on-failure
capturer2:
image: ticdc:latest
build:
context: .
dockerfile: ./Dockerfile.development
volumes:
- /data
- ./docker/logs:/logs
entrypoint: "/cdc server"
command:
- --addr=0.0.0.0:8300
- --pd=http://upstream-pd:2379
- --log-file=/logs/capturer2.log
- --log-level=debug
- --advertise-addr=capturer2:8300
- --tz=${CDC_TIME_ZONE:-SYSTEM}
depends_on:
- "upstream-tidb"
- "downstream-tidb"
- "kafka"
restart: on-failure
upstream-pd:
image: pingcap/pd:release-4.0-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:release-4.0-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:release-4.0-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:release-4.0-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:release-4.0-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:release-4.0-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:release-4.0-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:release-4.0-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:release-4.0-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:release-4.0-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'
schema-registry:
image: confluentinc/cp-schema-registry:5.5.1
container_name: schema-registry
ports:
- 8081:8081
depends_on:
- zookeeper
- kafka
environment:
SCHEMA_REGISTRY_HOST_NAME: schema-registry
SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL: zookeeper:2181
kafka-connect-01:
image: confluentinc/cp-kafka-connect:5.5.1
container_name: kafka-connect-01
depends_on:
- zookeeper
- kafka
- schema-registry
- downstream-tidb
ports:
- 8083:8083
environment:
CONNECT_LOG4J_APPENDER_STDOUT_LAYOUT_CONVERSIONPATTERN: "[%d] %p %X{connector.context}%m (%c:%L)%n"
CONNECT_BOOTSTRAP_SERVERS: "kafka:29092"
CONNECT_REST_PORT: 8083
CONNECT_REST_ADVERTISED_HOST_NAME: "kafka-connect-01"
CONNECT_GROUP_ID: compose-connect-group
CONNECT_CONFIG_STORAGE_TOPIC: docker-connect-configs
CONNECT_OFFSET_STORAGE_TOPIC: docker-connect-offsets
CONNECT_STATUS_STORAGE_TOPIC: docker-connect-status
CONNECT_KEY_CONVERTER: io.confluent.connect.avro.AvroConverter
CONNECT_KEY_CONVERTER_SCHEMA_REGISTRY_URL: 'http://schema-registry:8081'
CONNECT_VALUE_CONVERTER: io.confluent.connect.avro.AvroConverter
CONNECT_VALUE_CONVERTER_SCHEMA_REGISTRY_URL: 'http://schema-registry:8081'
CONNECT_INTERNAL_KEY_CONVERTER: "org.apache.kafka.connect.json.JsonConverter"
CONNECT_INTERNAL_VALUE_CONVERTER: "org.apache.kafka.connect.json.JsonConverter"
CONNECT_LOG4J_ROOT_LOGLEVEL: "INFO"
CONNECT_LOG4J_LOGGERS: "org.apache.kafka.connect.runtime.rest=WARN,org.reflections=ERROR"
CONNECT_CONFIG_STORAGE_REPLICATION_FACTOR: "1"
CONNECT_OFFSET_STORAGE_REPLICATION_FACTOR: "1"
CONNECT_STATUS_STORAGE_REPLICATION_FACTOR: "1"
CONNECT_PLUGIN_PATH: '/usr/share/java'
command:
- /bin/bash
- -c
- |
# JDBC Drivers
# ------------
# MySQL
cd /usr/share/java/kafka-connect-jdbc/
wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-8.0.21.tar.gz
tar -xf mysql-connector-java-8.0.21.tar.gz
mv mysql-connector-java-8.0.21/mysql-connector-java-8.0.21.jar ./
# Now launch Kafka Connect
sleep infinity &
/etc/confluent/docker/run
kafka-connect-healthcheck:
image: devshawn/kafka-connect-healthcheck:0.1.0
container_name: kafka-connect-healthcheck
depends_on:
- kafka-connect-01
ports:
- 18083:18083
environment:
HEALTHCHECK_CONNECT_URL: 'http://kafka-connect-01:8083'