-
Notifications
You must be signed in to change notification settings - Fork 0
/
compose.yml
142 lines (134 loc) · 5.01 KB
/
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
131
132
133
134
135
136
137
138
139
140
141
142
services:
broker1:
image: confluentinc/cp-kafka:${KAFKA_VERSION}${PLATFORM}
hostname: broker1
container_name: broker1
ports:
- "9092:9092"
- "9101:9101"
environment:
KAFKA_BROKER_ID: 1
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: 'CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT'
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://broker1:9092'
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_JMX_PORT: 9101
KAFKA_JMX_HOSTNAME: localhost
KAFKA_PROCESS_ROLES: 'broker,controller'
KAFKA_NODE_ID: 1
# https://kafka.apache.org/documentation/#brokerconfigs_controller.quorum.voters
KAFKA_CONTROLLER_QUORUM_VOTERS: '1@broker1:29092,2@broker2:29092,3@broker3:29092'
KAFKA_LISTENERS: 'PLAINTEXT://:9092,CONTROLLER://:29092'
KAFKA_INTER_BROKER_LISTENER_NAME: 'PLAINTEXT'
KAFKA_CONTROLLER_LISTENER_NAMES: 'CONTROLLER'
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'false'
KAFKA_LOG_DIRS: '/tmp/kraft-combined-logs'
CLUSTER_ID: ${CLUSTER_ID}
volumes:
- type: volume
source: kafka1_data
target: /var/lib/kafka
broker2:
image: confluentinc/cp-kafka:${KAFKA_VERSION}${PLATFORM}
hostname: broker2
container_name: broker2
ports:
- "9093:9092"
- "9102:9102"
environment:
KAFKA_BROKER_ID: 2
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: 'CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT'
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://broker2:9092'
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_JMX_PORT: 9102
KAFKA_JMX_HOSTNAME: localhost
KAFKA_PROCESS_ROLES: 'broker,controller'
KAFKA_NODE_ID: 2
KAFKA_CONTROLLER_QUORUM_VOTERS: '1@broker1:29092,2@broker2:29092,3@broker3:29092'
KAFKA_LISTENERS: 'PLAINTEXT://:9092,CONTROLLER://:29092'
KAFKA_INTER_BROKER_LISTENER_NAME: 'PLAINTEXT'
KAFKA_CONTROLLER_LISTENER_NAMES: 'CONTROLLER'
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'false'
KAFKA_LOG_DIRS: '/tmp/kraft-combined-logs'
CLUSTER_ID: OWI2NTYxMGU1ODg2NDQyMW
volumes:
- type: volume
source: kafka2_data
target: /var/lib/kafka
broker3:
image: confluentinc/cp-kafka:${KAFKA_VERSION}${PLATFORM}
hostname: broker3
container_name: broker3
ports:
- "9094:9092"
- "9103:9103"
environment:
KAFKA_BROKER_ID: 3
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: 'CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT'
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://broker3:9092'
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_JMX_PORT: 9103
KAFKA_JMX_HOSTNAME: localhost
KAFKA_PROCESS_ROLES: 'broker,controller'
KAFKA_NODE_ID: 3
KAFKA_CONTROLLER_QUORUM_VOTERS: '1@broker1:29092,2@broker2:29092,3@broker3:29092'
KAFKA_LISTENERS: 'PLAINTEXT://:9092,CONTROLLER://:29092'
KAFKA_INTER_BROKER_LISTENER_NAME: 'PLAINTEXT'
KAFKA_CONTROLLER_LISTENER_NAMES: 'CONTROLLER'
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'false'
KAFKA_LOG_DIRS: '/tmp/kraft-combined-logs'
CLUSTER_ID: OWI2NTYxMGU1ODg2NDQyMW
volumes:
- type: volume
source: kafka3_data
target: /var/lib/kafka
akhq:
image: tchiotludo/akhq:latest
environment:
JAVA_OPTS: -Duser.timezone=Europe/Amsterdam
AKHQ_CONFIGURATION: |
akhq:
connections:
local:
properties:
bootstrap.servers: "broker1:9092,broker2:9092,broker3:9092"
ports:
- "8405:8080"
kafka-setup:
image: confluentinc/cp-kafka:${KAFKA_VERSION}${PLATFORM}
container_name: kafka-setup
depends_on:
- "broker1"
- "broker2"
- "broker3"
command: /bin/bash -c '/usr/bin/kafka-topics --bootstrap-server broker1:9092,broker2:9092,broker3:9092 --create --if-not-exists --topic test --partitions 6 --replication-factor 3'
producer:
image: confluentinc/cp-kafka:${KAFKA_VERSION}${PLATFORM}
container_name: producer
depends_on:
- "broker1"
- "broker2"
- "broker3"
- "kafka-setup"
command: /bin/bash -c 'for nr in {1..1000000}; do echo "$(date +%s) "#"$$nr"; sleep .5; done | /usr/bin/kafka-console-producer --request-required-acks all --broker-list broker1:9092,broker2:9092,broker3:9092 --topic test'
consumer:
image: confluentinc/cp-kafka:${KAFKA_VERSION}${PLATFORM}
container_name: consumer
depends_on:
- "broker1"
- "broker2"
- "broker3"
- kafka-setup
command: /bin/sh -c '/usr/bin/kafka-console-consumer --bootstrap-server broker1:9092,broker2:9092,broker3:9092 --topic test --from-beginning'
volumes:
kafka1_data:
kafka2_data:
kafka3_data: