Since Kafka 3.3, KRaft mode (Kafka’s own metadata quorum) is production-ready for new clusters, and ZooKeeper is deprecated. This walkthrough runs a single node for learning.
sudo apt install -y openjdk-17-jre-headless
curl -O https://downloads.apache.org/kafka/3.7.0/kafka_2.13-3.7.0.tgz
tar -xzf kafka_2.13-3.7.0.tgz && cd kafka_2.13-3.7.0
KAFKA_CLUSTER_ID=$(bin/kafka-storage.sh random-uuid)
bin/kafka-storage.sh format -t $KAFKA_CLUSTER_ID -c config/kraft/server.properties
bin/kafka-server-start.sh config/kraft/server.properties
In another terminal:
bin/kafka-topics.sh --create --topic orders --partitions 3 --bootstrap-server localhost:9092
bin/kafka-console-producer.sh --topic orders --bootstrap-server localhost:9092
bin/kafka-console-consumer.sh --topic orders --from-beginning --bootstrap-server localhost:9092
Concepts:
- A topic is split into partitions; order is guaranteed only within a partition.
- Messages stay for the retention period (7 days by default), not until read.
- Keys decide the partition, so related messages keep their order.
Apache Kafka 3.8 is expected in July. Production clusters need at least three brokers.