frank@ZZHPC:~/download$ sudo adduser --system --no-create-home --group kafka frank@ZZHPC:~/download$ wget https://dlcdn.apache.org/kafka/4.1.1/kafka_2.13-4.1.1.tgz frank@ZZHPC:~/download$ tar -xzf kafka_2.13-4.1.1.tgz frank@ZZHPC:~/download$ sudo mv kafka_2.13-4.1.1 /opt
export KAFKA_HOME=/opt/kafka_2.13-4.1.1 export PATH=$PATH:$SPARK_HOME/sbin:$SPARK_HOME/bin:$FLINK_HOME/bin:$KAFKA_HOME/bin
Here is a complete, copy-paste-ready setup for a single-node Kafka 4.1.1 KRaft cluster on Ubuntu.
This is the simplest reliable configuration for development or local testing.
✅ 1. Create a minimal KRaft config file
Create:
✅ 2. Generate a cluster ID
✅ 3. Format the KRaft metadata directory
Use the generated cluster ID here:
✅ 4. Start Kafka (no ZooKeeper required)
🎉 5. Test your Kafka instance
Create a topic:
Produce messages:
Consume messages:
🚀 You now have a working single-node Kafka 4.1.1 setup!
If you'd like, I can also provide:
-
Systemd service files to run Kafka automatically on boot
-
A docker-compose setup for Kafka 4.x
-
A multi-node KRaft cluster config
frank@ZZHPC:~$ kafka-topics.sh --delete --topic test-topic --bootstrap-server localhost:9092

浙公网安备 33010602011771号