-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkraft-cluster.yml
128 lines (114 loc) · 3.8 KB
/
kraft-cluster.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
## Create local folders to bind/mount from inside `compose` folder
# mkdir -p logs/kraft-kafka{1,2,3}
x-environment-common: &environment-common
KAFKA_CONFIG_SOURCE: env
CLUSTER_ID: w3rNt4dlTIW_RoSUh7cmAQ
#log4j.logger.kafka: DEBUG
#log4j.logger.org.apache.kafka: DEBUG
server.auto.create.topics.enable: "false"
server.inter.broker.listener.name: INTERNAL
server.controller.listener.names: CONTROLLER
server.listener.security.protocol.map: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,CONTROLLER:PLAINTEXT
server.listeners: INTERNAL://:9092,EXTERNAL://:9094,CONTROLLER://:9093
services:
kafka1:
image: moukoublen/kafka:latest
ports:
- "19101:9094"
environment:
<<: *environment-common
server.node.id: 1
server.broker.id: 1
server.advertised.listeners: INTERNAL://kafka1:9092,EXTERNAL://localhost:19101
server.controller.quorum.voters: 1@kafka1:9093,2@kafka2:9093,3@kafka3:9093
server.process.roles: broker,controller
restart: on-failure
volumes:
- type: bind
source: ./logs/kraft-kafka1
target: /kafka-logs
kafka2:
image: moukoublen/kafka:latest
ports:
- "19102:9094"
environment:
<<: *environment-common
server.node.id: 2
server.broker.id: 2
server.advertised.listeners: INTERNAL://kafka2:9092,EXTERNAL://localhost:19102
server.controller.quorum.voters: 1@kafka1:9093,2@kafka2:9093,3@kafka3:9093
server.process.roles: broker,controller
restart: on-failure
volumes:
- type: bind
source: ./logs/kraft-kafka2
target: /kafka-logs
kafka3:
image: moukoublen/kafka:latest
ports:
- "19103:9094"
environment:
<<: *environment-common
server.node.id: 3
server.broker.id: 3
server.advertised.listeners: INTERNAL://kafka3:9092,EXTERNAL://localhost:19103
server.controller.quorum.voters: 1@kafka1:9093,2@kafka2:9093,3@kafka3:9093
server.process.roles: broker,controller
restart: on-failure
volumes:
- type: bind
source: ./logs/kraft-kafka3
target: /kafka-logs
topics-seed:
image: moukoublen/kafka:latest
restart: on-failure
command: >
bash -c "set -ex
echo 'Seeding topics'
kafka-topics.sh --bootstrap-server 'INTERNAL://kafka1:9092,INTERNAL://kafka2:9092,INTERNAL://kafka3:9092' \\
--create \\
--topic samples1 \\
--partitions 9 \\
--replication-factor 2 \\
--if-not-exists
kafka-topics.sh --bootstrap-server 'INTERNAL://kafka1:9092,INTERNAL://kafka2:9092,INTERNAL://kafka3:9092' \\
--create \\
--topic samples2 \\
--partitions 9 \\
--replication-factor 2 \\
--if-not-exists
kafka-topics.sh --bootstrap-server 'INTERNAL://kafka1:9092,INTERNAL://kafka2:9092,INTERNAL://kafka3:9092' --list"
## You can choose and uncomment one (or more) of those admin panels.
# kafdrop:
# # https://github.com/obsidiandynamics/kafdrop
# image: obsidiandynamics/kafdrop:latest
# ports:
# - 9000:9000
# environment:
# KAFKA_BROKERCONNECT: kafka1:9092,kafka2:9092,kafka3:9092
# JVM_OPTS: -Xms32M -Xmx64M
# SERVER_SERVLET_CONTEXTPATH: /
kafka-ui:
# https://github.com/provectus/kafka-ui
image: provectuslabs/kafka-ui:latest
ports:
- 8080:8080
environment:
KAFKA_CLUSTERS_0_NAME: local
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka1:9092,kafka2:9092,kafka3:9092
# akhq:
# # https://github.com/tchiotludo/akhq
# image: tchiotludo/akhq:latest
# ports:
# - 8080:8080
# environment:
# AKHQ_CONFIGURATION: |
# akhq:
# connections:
# docker-kafka-server:
# properties:
# bootstrap.servers: "kafka1:9092,kafka2:9092,kafka3:9092"
networks:
kafkanet: {}
default:
name: kafkanet