-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
275 lines (266 loc) · 12.6 KB
/
docker-compose.yaml
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
---
version: '3.5'
services:
zookeeper-add-kafka-users:
image: quay.io/debezium/kafka:1.9
container_name: "zookeeper-add-kafka-users"
depends_on:
- zookeeper-1
- zookeeper-2
- zookeeper-3
command: "bash -c 'echo Waiting for Zookeeper to be ready... && \
cub zk-ready zookeeper-1:22181 120 && \
cub zk-ready zookeeper-2:32181 120 && \
cub zk-ready zookeeper-3:42181 120 && \
kafka-configs --zookeeper zookeeper-1:22181 --alter --add-config 'SCRAM-SHA-256=[iterations=4096,password=password]' --entity-type users --entity-name metricsreporter && \
kafka-configs --zookeeper zookeeper-1:22181 --alter --add-config 'SCRAM-SHA-256=[iterations=4096,password=password]' --entity-type users --entity-name kafkaclient && \
kafka-configs --zookeeper zookeeper-1:22181 --alter --add-config 'SCRAM-SHA-256=[iterations=4096,password=password]' --entity-type users --entity-name kafkabroker '"
environment:
KAFKA_BROKER_ID: ignored
KAFKA_ZOOKEEPER_CONNECT: ignored
KAFKA_OPTS: -Djava.security.auth.login.config=/etc/kafka/secrets/zookeeper_client_jaas.conf
networks:
- kafka-cluster-network
volumes:
- ${KAFKA_SASL_SCRAM_SECRETS_DIR}/zookeeper_client_jaas.conf:/etc/kafka/secrets/zookeeper_client_jaas.conf
zookeeper-1:
image: confluentinc/cp-zookeeper:5.0.1
hostname: zookeeper-1
container_name: zookeeper-1
ports:
- "22181:22181"
environment:
ZOOKEEPER_SERVER_ID: 1
ZOOKEEPER_CLIENT_PORT: 22181
ZOOKEEPER_TICK_TIME: 2000
ZOOKEEPER_INIT_LIMIT: 5
ZOOKEEPER_SYNC_LIMIT: 2
ZOOKEEPER_LOG4J_ROOT_LOGLEVEL: "DEBUG"
ZOOKEEPER_SERVERS: zookeeper-1:22888:23888;zookeeper-2:32888:33888;zookeeper-3:42888:43888
KAFKA_OPTS: -Djava.security.auth.login.config=/etc/kafka/secrets/zookeeper_server_jaas.conf
-Dquorum.auth.enableSasl=true
-Dquorum.auth.learnerRequireSasl=true
-Dquorum.auth.serverRequireSasl=true
-Dquorum.cnxn.threads.size=20
-Dzookeeper.authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider
-Dzookeeper.authProvider.2=org.apache.zookeeper.server.auth.DigestAuthenticationProvider
-DjaasLoginRenew=3600000
-DrequireClientAuthScheme=sasl
-Dquorum.auth.learner.loginContext=QuorumLearner
-Dquorum.auth.server.loginContext=QuorumServer
networks:
- kafka-cluster-network
volumes:
- ${KAFKA_SASL_SCRAM_SECRETS_DIR}/zookeeper_server_jaas.conf:/etc/kafka/secrets/zookeeper_server_jaas.conf
zookeeper-2:
image: confluentinc/cp-zookeeper:5.0.1
hostname: zookeeper-2
container_name: zookeeper-2
ports:
- "32181:32181"
environment:
ZOOKEEPER_SERVER_ID: 2
ZOOKEEPER_CLIENT_PORT: 32181
ZOOKEEPER_TICK_TIME: 2000
ZOOKEEPER_INIT_LIMIT: 5
ZOOKEEPER_SYNC_LIMIT: 2
ZOOKEEPER_LOG4J_ROOT_LOGLEVEL: "DEBUG"
ZOOKEEPER_SERVERS: zookeeper-1:22888:23888;zookeeper-2:32888:33888;zookeeper-3:42888:43888
KAFKA_OPTS: -Djava.security.auth.login.config=/etc/kafka/secrets/zookeeper_server_jaas.conf
-Dquorum.auth.enableSasl=true
-Dquorum.auth.learnerRequireSasl=true
-Dquorum.auth.serverRequireSasl=true
-Dquorum.cnxn.threads.size=20
-Dzookeeper.authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider
-Dzookeeper.authProvider.2=org.apache.zookeeper.server.auth.DigestAuthenticationProvider
-DjaasLoginRenew=3600000
-DrequireClientAuthScheme=sasl
-Dquorum.auth.learner.loginContext=QuorumLearner
-Dquorum.auth.server.loginContext=QuorumServer
networks:
- kafka-cluster-network
volumes:
- ${KAFKA_SASL_SCRAM_SECRETS_DIR}/zookeeper_server_jaas.conf:/etc/kafka/secrets/zookeeper_server_jaas.conf
zookeeper-3:
image: confluentinc/cp-zookeeper:5.0.1
hostname: zookeeper-3
container_name: zookeeper-3
ports:
- "42181:42181"
environment:
ZOOKEEPER_SERVER_ID: 3
ZOOKEEPER_CLIENT_PORT: 42181
ZOOKEEPER_TICK_TIME: 2000
ZOOKEEPER_INIT_LIMIT: 5
ZOOKEEPER_SYNC_LIMIT: 2
ZOOKEEPER_LOG4J_ROOT_LOGLEVEL: "DEBUG"
ZOOKEEPER_SERVERS: zookeeper-1:22888:23888;zookeeper-2:32888:33888;zookeeper-3:42888:43888
KAFKA_OPTS: -Djava.security.auth.login.config=/etc/kafka/secrets/zookeeper_server_jaas.conf
-Dquorum.auth.enableSasl=true
-Dquorum.auth.learnerRequireSasl=true
-Dquorum.auth.serverRequireSasl=true
-Dquorum.cnxn.threads.size=20
-Dzookeeper.authProvider.1=org.apache.zookeeper.server.auth.SASLAuthenticationProvider
-Dzookeeper.authProvider.2=org.apache.zookeeper.server.auth.DigestAuthenticationProvider
-DjaasLoginRenew=3600000
-DrequireClientAuthScheme=sasl
-Dquorum.auth.learner.loginContext=QuorumLearner
-Dquorum.auth.server.loginContext=QuorumServer
networks:
- kafka-cluster-network
volumes:
- ${KAFKA_SASL_SCRAM_SECRETS_DIR}/zookeeper_server_jaas.conf:/etc/kafka/secrets/zookeeper_server_jaas.conf
kafka-broker-1:
image: confluentinc/cp-kafka:5.0.1
hostname: kafka-broker-1
container_name: kafka-broker-1
ports:
- "19093:19093"
- "19094:19094"
depends_on:
- zookeeper-1
- zookeeper-2
- zookeeper-3
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper-1:22181,zookeeper-1:32181,zookeeper-1:42181
KAFKA_ADVERTISED_LISTENERS: SSL://kafka-broker-1:19093,SASL_SSL://kafka-broker-1:19094
KAFKA_SSL_KEYSTORE_FILENAME: kafka.broker-1.keystore.jks
KAFKA_SSL_KEYSTORE_CREDENTIALS: broker-1_keystore_creds
KAFKA_SSL_KEY_CREDENTIALS: broker-1_sslkey_creds
KAFKA_SSL_TRUSTSTORE_FILENAME: kafka.broker-1.truststore.jks
KAFKA_SSL_TRUSTSTORE_CREDENTIALS: broker-1_truststore_creds
CONFLUENT_METRICS_REPORTER_SSL_TRUSTSTORE_LOCATION: /etc/kafka/secrets/kafka.broker-1.truststore.jks
CONFLUENT_METRICS_REPORTER_SSL_TRUSTSTORE_PASSWORD: confluent
CONFLUENT_METRICS_REPORTER_SSL_KEYSTORE_LOCATION: /etc/kafka/secrets/kafka.broker-1.keystore.jks
CONFLUENT_METRICS_REPORTER_SSL_KEYSTORE_PASSWORD: confluent
KAFKA_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM: "HTTPS"
KAFKA_SSL_CLIENT_AUTH: requested
KAFKA_MIN_INSYNC_REPLICAS: ${KAFKA_MIN_INSYNC_REPLICAS}
KAFKA_SASL_ENABLED_MECHANISMS: SCRAM-SHA-256
KAFKA_SECURITY_INTER_BROKER_PROTOCOL: SASL_SSL
KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL: SCRAM-SHA-256
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
CONFLUENT_METRICS_REPORTER_SECURITY_PROTOCOL: SASL_SSL
CONFLUENT_METRICS_REPORTER_SASL_MECHANISM: SCRAM-SHA-256
CONFLUENT_METRICS_REPORTER_BOOTSTRAP_SERVERS: ${CONFLUENT_METRICS_REPORTER_BOOTSTRAP_SERVERS}
KAFKA_OFFSETS_RETENTION_MINUTES: 172800
KAFKA_LOG4J_LOGGERS: "kafka.authorizer.logger=INFO,kafka.controller=INFO"
KAFKA_LOG4J_ROOT_LOGLEVEL: "INFO"
KAFKA_SUPER_USERS: ${KAFKA_SUPER_USERS}
KAFKA_ZOOKEEPER_SASL_ENABLED: "true"
KAFKA_ZOOKEEPER_SET_ACL: "true"
KAFKA_AUTHORIZER_CLASS_NAME: kafka.security.auth.SimpleAclAuthorizer
KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "false"
KAFKA_OPTS: -Dzookeeper.sasl.client=true
-Dzookeeper.sasl.clientconfig=Client
-Djava.security.auth.login.config=/etc/kafka/secrets/conf/kafka_server_jaas.conf
volumes:
- ${KAFKA_SSL_SECRETS_DIR}/broker-1:/etc/kafka/secrets
- ${KAFKA_SASL_SCRAM_SECRETS_DIR}:/etc/kafka/secrets/conf
networks:
- kafka-cluster-network
kafka-broker-2:
image: confluentinc/cp-kafka:5.0.1
hostname: kafka-broker-2
container_name: kafka-broker-2
ports:
- "29093:29093"
- "29094:29094"
depends_on:
- zookeeper-1
- zookeeper-2
- zookeeper-3
environment:
KAFKA_BROKER_ID: 2
KAFKA_ZOOKEEPER_CONNECT: zookeeper-1:22181,zookeeper-1:32181,zookeeper-1:42181
KAFKA_ADVERTISED_LISTENERS: SSL://kafka-broker-2:29093,SASL_SSL://kafka-broker-2:29094
KAFKA_SSL_KEYSTORE_FILENAME: kafka.broker-2.keystore.jks
KAFKA_SSL_KEYSTORE_CREDENTIALS: broker-2_keystore_creds
KAFKA_SSL_KEY_CREDENTIALS: broker-2_sslkey_creds
KAFKA_SSL_TRUSTSTORE_FILENAME: kafka.broker-2.truststore.jks
KAFKA_SSL_TRUSTSTORE_CREDENTIALS: broker-2_truststore_creds
CONFLUENT_METRICS_REPORTER_SSL_TRUSTSTORE_LOCATION: /etc/kafka/secrets/kafka.broker-2.truststore.jks
CONFLUENT_METRICS_REPORTER_SSL_TRUSTSTORE_PASSWORD: confluent
CONFLUENT_METRICS_REPORTER_SSL_KEYSTORE_LOCATION: /etc/kafka/secrets/kafka.broker-2.keystore.jks
CONFLUENT_METRICS_REPORTER_SSL_KEYSTORE_PASSWORD: confluent
KAFKA_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM: "HTTPS"
KAFKA_SSL_CLIENT_AUTH: requested
KAFKA_MIN_INSYNC_REPLICAS: ${KAFKA_MIN_INSYNC_REPLICAS}
KAFKA_SASL_ENABLED_MECHANISMS: SCRAM-SHA-256
KAFKA_SECURITY_INTER_BROKER_PROTOCOL: SASL_SSL
KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL: SCRAM-SHA-256
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
CONFLUENT_METRICS_REPORTER_SECURITY_PROTOCOL: SASL_SSL
CONFLUENT_METRICS_REPORTER_SASL_MECHANISM: SCRAM-SHA-256
CONFLUENT_METRICS_REPORTER_BOOTSTRAP_SERVERS: ${CONFLUENT_METRICS_REPORTER_BOOTSTRAP_SERVERS}
KAFKA_OFFSETS_RETENTION_MINUTES: 172800
KAFKA_LOG4J_LOGGERS: "kafka.authorizer.logger=INFO,kafka.controller=INFO"
KAFKA_LOG4J_ROOT_LOGLEVEL: "INFO"
KAFKA_SUPER_USERS: ${KAFKA_SUPER_USERS}
KAFKA_ZOOKEEPER_SASL_ENABLED: "true"
KAFKA_ZOOKEEPER_SET_ACL: "true"
KAFKA_AUTHORIZER_CLASS_NAME: kafka.security.auth.SimpleAclAuthorizer
KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "false"
KAFKA_OPTS: -Dzookeeper.sasl.client=true
-Dzookeeper.sasl.clientconfig=Client
-Djava.security.auth.login.config=/etc/kafka/secrets/conf/kafka_server_jaas.conf
volumes:
- ${KAFKA_SSL_SECRETS_DIR}/broker-2:/etc/kafka/secrets
- ${KAFKA_SASL_SCRAM_SECRETS_DIR}:/etc/kafka/secrets/conf
networks:
- kafka-cluster-network
kafka-broker-3:
image: confluentinc/cp-kafka:5.0.1
hostname: kafka-broker-3
container_name: kafka-broker-3
ports:
- "39093:39093"
- "39094:39094"
depends_on:
- zookeeper-1
- zookeeper-2
- zookeeper-3
environment:
KAFKA_BROKER_ID: 3
KAFKA_ZOOKEEPER_CONNECT: zookeeper-1:22181,zookeeper-1:32181,zookeeper-1:42181
KAFKA_ADVERTISED_LISTENERS: SSL://kafka-broker-3:39093,SASL_SSL://kafka-broker-3:39094
KAFKA_SSL_KEYSTORE_FILENAME: kafka.broker-3.keystore.jks
KAFKA_SSL_KEYSTORE_CREDENTIALS: broker-3_keystore_creds
KAFKA_SSL_KEY_CREDENTIALS: broker-3_sslkey_creds
KAFKA_SSL_TRUSTSTORE_FILENAME: kafka.broker-3.truststore.jks
KAFKA_SSL_TRUSTSTORE_CREDENTIALS: broker-3_truststore_creds
CONFLUENT_METRICS_REPORTER_SSL_TRUSTSTORE_LOCATION: /etc/kafka/secrets/kafka.broker-3.truststore.jks
CONFLUENT_METRICS_REPORTER_SSL_TRUSTSTORE_PASSWORD: confluent
CONFLUENT_METRICS_REPORTER_SSL_KEYSTORE_LOCATION: /etc/kafka/secrets/kafka.broker-3.keystore.jks
CONFLUENT_METRICS_REPORTER_SSL_KEYSTORE_PASSWORD: confluent
KAFKA_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM: "HTTPS"
KAFKA_SSL_CLIENT_AUTH: requested
KAFKA_MIN_INSYNC_REPLICAS: ${KAFKA_MIN_INSYNC_REPLICAS}
KAFKA_SASL_ENABLED_MECHANISMS: SCRAM-SHA-256
KAFKA_SECURITY_INTER_BROKER_PROTOCOL: SASL_SSL
KAFKA_SASL_MECHANISM_INTER_BROKER_PROTOCOL: SCRAM-SHA-256
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
CONFLUENT_METRICS_REPORTER_SECURITY_PROTOCOL: SASL_SSL
CONFLUENT_METRICS_REPORTER_SASL_MECHANISM: SCRAM-SHA-256
CONFLUENT_METRICS_REPORTER_BOOTSTRAP_SERVERS: ${CONFLUENT_METRICS_REPORTER_BOOTSTRAP_SERVERS}
KAFKA_OFFSETS_RETENTION_MINUTES: 172800
KAFKA_LOG4J_LOGGERS: "kafka.authorizer.logger=INFO,kafka.controller=INFO"
KAFKA_LOG4J_ROOT_LOGLEVEL: "INFO"
KAFKA_SUPER_USERS: ${KAFKA_SUPER_USERS}
KAFKA_ZOOKEEPER_SASL_ENABLED: "true"
KAFKA_ZOOKEEPER_SET_ACL: "true"
KAFKA_AUTHORIZER_CLASS_NAME: kafka.security.auth.SimpleAclAuthorizer
KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND: "false"
KAFKA_OPTS: -Dzookeeper.sasl.client=true
-Dzookeeper.sasl.clientconfig=Client
-Djava.security.auth.login.config=/etc/kafka/secrets/conf/kafka_server_jaas.conf
volumes:
- ${KAFKA_SSL_SECRETS_DIR}/broker-3:/etc/kafka/secrets
- ${KAFKA_SASL_SCRAM_SECRETS_DIR}:/etc/kafka/secrets/conf
networks:
- kafka-cluster-network
networks:
kafka-cluster-network:
driver: bridge
name: kafka-cluster-network