01-broken-setup

This commit is contained in:
2026-01-25 00:43:01 +00:00
parent 9ef3580b8b
commit e2f9468319
4 changed files with 64 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
# Kafka data directories
**/kafka-data/
**/kafka-logs/
**/zookeeper-data/
# Docker volumes
**/.docker/
# IDE/Editor
.vscode/
.idea/
*.swp
*.swo
*~
.DS_Store
# OS files
Thumbs.db
.DS_Store
# Logs
*.log
logs/
# Temporary files
*.tmp
*.temp
View File
+22
View File
@@ -0,0 +1,22 @@
version: "3" # Docker Compose format version
services:
kafka:
image: apache/kafka:latest
container_name: kafka-crash-test
ports:
- "9092:9092" # host:container
environment:
KAFKA_NODE_ID: 1 # node identifier in cluster
KAFKA_PROCESS_ROLES: broker,controller # Combined broker + controller (KRaft mode, no Zookeeper)
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka:9093 # Controller nodes for quorum (node_id@host:port)
# Listener configuration
KAFKA_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093 # Ports Kafka listens on internally
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092 # Address advertised to clients
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER # Listener for controller communication
KAFKA_LOG_DIRS: /var/lib/kafka/data # Directory for message data storage
volumes:
- ./kafka-data:/var/lib/kafka/data # Persist data across container restarts
+15
View File
@@ -1 +1,16 @@
learning kafka
# Setup
Take a look at 01-broken-setup. Ideally when you setup, you need to have a meta.properties file in the kafka-data ( /var/lib/kafka/data ) directory. This file is created when Kafka starts for the first time.
```
#
#Sat Jan 24 19:02:17 GMT 2026
cluster.id=5L6g3nShT-eMCtK--X86sw
directory.id=Xsizaw8IS7uzzJrI-zTLMQ
node.id=1
version=1
```
If this file is missing, the docker image will make one. But in case you run multiple brokers, all need to have the same cluster.id. So they can talk to each other. This is known as generate/format Kraft storage.