Kafka Raft (KRaft) is designed to allow you to run Kafka without a dependency on ZooKeeper.
To set up Kafka without ZooKeeper:
- Download and install the binary Scala 2.12 - kafka_2.12-3.3.2.tgz (asc, sha512).
- Untar it to the Kafka location and modify the soft link:
cd /opt/nastel/kafka
tar -zxvf kafka_2.12-3.3.2.tgz
unlink current
To link the new Kafka package:
ln -s kafka_2.12-3.3.2/ current
- Enter
cd current/config/kraft
. - Check the server.properties file and edit it to match the example below:
node.id=1
process.roles=broker, controller
inter.broker.listener.name=PLAINTEXT
controller.listener.names=CONTROLLER
listeners=PLAINTEXT://: 9092, CONTROLLER://:19092
log.dirs=/tmp/serverl/kraft-combined-logs
listener.security.protocol.map=CONTROLLER:PLAINTEXT,PLAINTEXT: PLAINTEXT, SSL: SSL, SASL PLAINTEXT: SASL_ PLAINTEX T, SASL_SSL: SASL_SSL
controller.quorum.voters=1@localhost:19092,2@localhost:19093,3@localhost:19094
- Create a new uuid that will be used as your cluster id-1. From the Kafka bin directory, run the command below to generate a unique uuid. Be sure to copy it for future use.
./bin/kafka-storage.sh random-uuid
An example of the resultant uuid is provided below.
jwuHZEcQSO2dA3m2tZhjIQ
The basic command to format locations based on each server's property file is as follows: ./bin/kafka-storage.sh format -t jwuHZEcQSO2dA3m2tZhjIQ -c ../config/kraft/server.properties
In the command above, -t
is used to format storage with the generated UUID when running Kafka in KRaft mode; -c
indicates the configuration file to format the storage.
Start Kafka
When Kafka uses KRaft, Kafka must start using a specific location. To start Kafka, be sure to use the modified startup script below.
Start Kafka by running the following:
./bin/kafka-server-start.sh -daemon ../config/kraft/server.properties
Create topics
To create Kafka topics, Kafka must be running. See the Start Kafka section above.
Create Kafka topics using the jKool Kafka topics creation script under AutoPilotM6. The location of the script is:
/opt/nastel/AutoPilotM6/jkool/scripts
Execute the following script to create topics:
create-kafka-topics.sh