-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
60 lines (57 loc) · 2.67 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
version: "2.2"
services:
zookeeper:
image: wurstmeister/zookeeper
ports:
- "2181:2181"
kafka:
image: wurstmeister/kafka
depends_on:
- zookeeper
ports:
- "9092:9092"
environment:
# region Listeners configuration
# With the following configuration, Kafka will be accesible:
# * To the Docker containers inside the VM through `kafka:29092`
# * To the VM and the host machine through `localhost:9092`
KAFKA_LISTENERS: INSIDE://kafka:29092,OUTSIDE://:9092
KAFKA_ADVERTISED_LISTENERS: INSIDE://kafka:29092,OUTSIDE://localhost:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INSIDE:PLAINTEXT,OUTSIDE:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: INSIDE
# endregion
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
# Create 3 topics:
# * movies: 1 partitions, 1 replicas, compacted
# * directors: 1 partitions, 1 replicas, compacted
# * directors-movies: 1 partitions, 1 replicas, compacted
KAFKA_CREATE_TOPICS: "movies:1:1:compact,directors:1:1:compact,directors-movies:1:1:compact"
# Create topics automatically
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
# region Log compaction configuration
# Segment size of 1MB (event size is around 200B)
# This allows compaction to take effect in non-active segments in this PoC
KAFKA_LOG_SEGMENT_BYTES: 1024
# The minimum ratio of dirty log to total log for a log to be eligible for cleaning
# A higher ratio will mean fewer, more efficient cleanings but will mean more wasted space in the log
# A log is elegible for cleaning if there is, at least, a 10% of duplicates
KAFKA_LOG_CLEANER_MIN_CLEANABLE_RATIO: 0.1
# How long are delete records (tombstone) retained
# 5 minutes allow deletion of tombstones to be seen in this PoC
KAFKA_LOG_CLEANER_DELETE_RETENTION_MS: 300000
# endregion
volumes:
- /var/run/docker.sock:/var/run/docker.sock
# This will download the image and execute the container at the start of the VM
# and after executing `docker-compose up -d` from inside the VM.
# But the container will automatically shutdown, because it expects to receive args for the kafkacat command.
# You will have to create this docker container manually each time you need to execute a kafkacat command.
# Example:
# `docker run --network=vagrant_default -v /vagrant:/vagrant -it --rm edenhill/kafkacat:1.6.0 <kafkacat-args>`
# The /vagrant volume of the VM is mounted to the /vagrant folder, to allow kafkacat have access to project files
kafkacat:
image: edenhill/kafkacat:1.6.0
depends_on:
- kafka
volumes:
- /vagrant:/vagrant