-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
130 lines (121 loc) · 4.71 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
version: '3.5'
services:
zookeeper:
image: confluentinc/cp-zookeeper:7.1.1
container_name: zookeeper
hostname: zookeeper
# Enable this in M1 chip
#platform: linux/x86_64
ports:
- "2181:2181"
volumes:
- zookeeper-data:/var/lib/zookeeper/data
- zookeeper-transaction-logs:/var/lib/zookeeper/log
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_SERVER_ID: 1
ZOOKEEPER_SERVERS: zookeeper:2888:3888
kafka1:
image: confluentinc/cp-kafka:7.1.1
container_name: kafka1
hostname: kafka1
# Enable this in M1 chip
#platform: linux/x86_64
ports:
- "9092:9092"
volumes:
- kafka1-data:/var/lib/kafka/data
environment:
KAFKA_ADVERTISED_LISTENERS: INSIDE://kafka1:29092,OUTSIDE://localhost:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
KAFKA_ZOOKEEPER_CONNECT: "zookeeper:2181"
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
depends_on:
- zookeeper
kafka-connect:
image: confluentinc/cp-kafka-connect:6.1.9
container_name: kafka-connect
depends_on:
- kafka1
ports:
- 8083:8083
environment:
CONNECT_BOOTSTRAP_SERVERS: "kafka1:29092"
CONNECT_REST_PORT: 8083
CONNECT_GROUP_ID: kafka-connect
CONNECT_CONFIG_STORAGE_TOPIC: _connect-configs
CONNECT_OFFSET_STORAGE_TOPIC: _connect-offsets
CONNECT_STATUS_STORAGE_TOPIC: _connect-status
CONNECT_KEY_CONVERTER: org.apache.kafka.connect.json.JsonConverter
CONNECT_VALUE_CONVERTER: org.apache.kafka.connect.json.JsonConverter
CONNECT_REST_ADVERTISED_HOST_NAME: "kafka-connect"
CONNECT_LOG4J_APPENDER_STDOUT_LAYOUT_CONVERSIONPATTERN: "[%d] %p %X{connector.context}%m (%c:%L)%n"
CONNECT_CONFIG_STORAGE_REPLICATION_FACTOR: "1"
CONNECT_OFFSET_STORAGE_REPLICATION_FACTOR: "1"
CONNECT_STATUS_STORAGE_REPLICATION_FACTOR: "1"
# ---------------
CONNECT_PLUGIN_PATH: /usr/share/java,/usr/share/confluent-hub-components,/data/plugins
# If you want to use the Confluent Hub installer to download components, but make them available
# when running this offline, spin up the stack once and then run :
# docker cp kafka-connect:/usr/share/confluent-hub-components ./data/plugins
volumes:
- ./data/plugins:/data/plugins
- ./data/libs:/data/libs
# In the command section, $ are replaced with $$ to avoid the error 'Invalid interpolation format for "command" option'
command:
- bash
- -c
- |
echo "Installing Connectors"
confluent-hub install --no-prompt confluentinc/kafka-connect-jdbc:10.6.0
# MySQL driver has to be on the same directory with JDBC connector plugin.
echo "Copying MySQL's JDBC Driver into Kafka JDBC connector's diretory"
cp /data/libs/mysql-connector/mysql-connector-j-8.0.32.jar /usr/share/confluent-hub-components/confluentinc-kafka-connect-jdbc/lib
confluent-hub install --no-prompt confluentinc/kafka-connect-elasticsearch:14.0.3
#
echo "Launching Kafka Connect worker"
/etc/confluent/docker/run &
#
sleep infinity
mysql:
image: mysql
container_name: mysql
# Enable this in M1 chip
# platform: linux/x86_64
command: --default-authentication-plugin=mysql_native_password
restart: always
ports:
- '3306:3306'
volumes:
- mysql-data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: test
MYSQL_USER: admin
MYSQL_PASSWORD: admin
elasticsearch:
image: elasticsearch:8.6.1
container_name: elasticsearch
volumes:
- elasticsearch-data:/usr/share/elasticsearch/data
ports:
- "9200:9200"
environment:
# Disable security or Elasticsearch fails with the error
# "Transport SSL must be enabled if security is enabled. Please set [xpack.security.transport.ssl.enabled] to [true] or disable security by setting [xpack.security.enabled] to [false]"
xpack.security.enabled: "false"
# Set discovery.type or Elasticsearch fails with this error
# "the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured"
# See https://stackoverflow.com/questions/59350069/elasticsearch-start-up-error-the-default-discovery-settings-are-unsuitable-for#61547317
discovery.type: "single-node"
ingest.geoip.downloader.enabled: "false"
ES_JAVA_OPTS: "-Xms1g -Xmx1g"
volumes:
zookeeper-data:
zookeeper-transaction-logs:
kafka1-data:
mysql-data:
driver: local
elasticsearch-data:
driver: local