- KRaft removes the dependency on ZooKeeper by storing cluster metadata in a Raft quorum.
- Recommended for new Kafka deployments, since Kafka is migrating metadata management to KRaft.
- Download a Kafka release
- Extract and inspect the Kafka directory
- Inspect
config/kraftand key KRaft config files - Generate a cluster ID (UUID)
- Format local storage for KRaft metadata
- Start Kafka in KRaft mode and verify logs
- CentOS (or similar Linux) with wget and tar installed
- Java installed and JAVA_HOME configured
- Sufficient disk space for Kafka logs (default uses
/tmpunless changed in config)
- Download Kafka 3.0.0 (Scala 2.13) tarball:
- Extract the archive:
config, bin, libs, and site-docs.
Inspect the config directory and KRaft-specific configs
Change into config and examine KRaft-related files:
kraft/ subdirectory containing KRaft config files:
config/kraft:
For simple single-node testing you often can use the defaults. For production clusters tune the
controller.properties and broker.properties as needed.
Generate a cluster ID (random UUID)
KRaft stores metadata locally and requires an initial formatting step. First generate a cluster ID (a random UUID) using Kafka’s helper script:
kafka-storage.sh format command to initialize the local metadata storage. Replace the UUID below with the one returned by random-uuid. Also point to the server.properties inside config/kraft.
- Initializes the KRaft metadata directory (default path is typically
/tmp/kraft-combined-logsunless changed inserver.properties) - Writes the initial metadata snapshot and prepares the node to become part of a Raft quorum
server.properties:
- Look for Raft/Controller-related logs such as
RaftManager,KafkaRaftClient,ControllerServer— these indicate KRaft mode. - If ZooKeeper were in use, you would instead see ZooKeeper connection logs and
zookeeper.*properties being used.
Recommendation
For new Kafka deployments, prefer KRaft mode (ZooKeeper-less) because Kafka is moving towards KRaft for metadata management. Use the
config/kraft files (server.properties, controller.properties, broker.properties) to tune controller and broker behavior as your cluster grows.- If the broker fails to start, check that the
node.id,process.roles, andcontroller.quorum.votersvalues are correct for your topology. - Ensure the metadata directory specified in
server.propertiesis writable by the Kafka process. - If you see ZooKeeper-related settings populated, confirm you are using the
config/kraft/server.propertiesfile when formatting and starting Kafka.
- Apache Kafka: https://kafka.apache.org/
- KRaft documentation: https://kafka.apache.org/documentation/#kraft
- ZooKeeper: https://zookeeper.apache.org/
- Kafka downloads archive: https://archive.apache.org/dist/kafka/