-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
110 lines (103 loc) · 3.05 KB
/
docker-compose.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
version: '3.9'
services:
postgres:
image: debezium/example-postgres:latest
container_name: postgres
ports:
- "5433:5432"
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
# Zookeeper, single node
zookeeper:
image: wurstmeister/zookeeper:latest
platform: linux/amd64 # https://stackoverflow.com/a/69636473
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
ports:
- "2181:2181"
- "2888:2888"
- "3888:3888"
# kafka multi node
kafka1:
image: wurstmeister/kafka:latest
restart: "no"
links:
- zookeeper
ports:
- "9092:9092"
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_LISTENERS: INTERNAL://:29092,EXTERNAL://:9092
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka1:29092,EXTERNAL://localhost:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
#https://github.com/wurstmeister/kafka-docker/issues/553
kafka2:
image: wurstmeister/kafka:latest
restart: "no"
links:
- zookeeper
ports:
- "9093:9093"
environment:
KAFKA_BROKER_ID: 2
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_LISTENERS: INTERNAL://:29093,EXTERNAL://:9093
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka2:29093,EXTERNAL://localhost:9093
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
#https://github.com/wurstmeister/kafka-docker/issues/553
#kafdrop for topic/msg visualization
kafdrop:
image: obsidiandynamics/kafdrop
platform: linux/amd64 # https://stackoverflow.com/a/69636473
restart: "no"
environment:
KAFKA_BROKERCONNECT: "kafka1:29092,kafka2:29093"
ports:
- "9000:9000"
depends_on:
- kafka1
- kafka2
# debezium connector
kconnect:
image: debezium/connect:2.4
ports:
- "8083:8083"
environment:
CONFIG_STORAGE_TOPIC: my_connect_configs
OFFSET_STORAGE_TOPIC: my_connect_offsets
STATUS_STORAGE_TOPIC: my_connect_statuses
BOOTSTRAP_SERVERS: kafka1:29092,kafka2:29093
links:
- zookeeper
- postgres
depends_on:
- kafka1
- kafka2
- zookeeper
- postgres
# 1. kafka & zookeeper --> docker
# 2. kafdrop --> docker
# 3. postgres --> docker
# 4. debezium connector --> docker
# 5. pgAdmin/DBeaver --> local system
# 6. Postman --> local system
# POST http://localhost:8083/connectors --> To register the kafka connector
# {
# "name": "inventory-connector",
# "config": {
# "connector.class": "io.debezium.connector.postgresql.PostgresConnector",
# "database.hostname": "postgres",
# "database.port": "5432",
# "database.user": "postgres",
# "database.password": "postgres",
# "database.dbname" : "postgres",
# "database.server.name": "dbserver1",
# "table.include.list": "inventory.customers",
# "topic.prefix": "orders"
# }
# }