diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9125522 --- /dev/null +++ b/.gitignore @@ -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 diff --git a/01-broken-setup/README.md b/01-broken-setup/README.md new file mode 100644 index 0000000..e69de29 diff --git a/01-broken-setup/docker-compose.yaml b/01-broken-setup/docker-compose.yaml new file mode 100644 index 0000000..257320c --- /dev/null +++ b/01-broken-setup/docker-compose.yaml @@ -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 diff --git a/README.md b/README.md index 0b6a4cd..66e8543 100644 --- a/README.md +++ b/README.md @@ -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.