Step-by-Step Guide to Installing and Using Apache Kafka 3.8.1 on Linux
This tutorial walks through downloading, extracting, configuring, starting, creating topics, producing and consuming messages, and finally stopping Apache Kafka 3.8.1 on a Linux system, including all necessary command‑line instructions.
Welcome to the "Internet Full Stack Architecture" public account; today's quote is "Take it slow, it's faster."
Installing Kafka is straightforward: download the binary package, extract it, and start the services; the tutorial uses version 3.8.1.
1. Download the Kafka tarball and extract it to /usr/local :
wget https://dlcdn.apache.org/kafka/3.8.1/kafka_2.13-3.8.1.tgz
tar -xzf kafka_2.13-3.8.1.tgz2. Change to the Kafka installation directory ( /usr/local/kafka_2.13-3.8.1 ) and verify the version:
cd kafka_2.13-3.8.1
bin/kafka-topics.sh --version
3.8.13. Start Kafka (after installing and starting Zookeeper on the same machine):
bin/kafka-server-start.sh config/server.properties &Kafka now runs; although version 3.8.1 can operate without Zookeeper, this guide follows the Zookeeper‑based setup.
4. Create a topic named fullstack and display its details to confirm creation:
bin/kafka-topics.sh --create --topic fullstack --bootstrap-server localhost:9092
bin/kafka-topics.sh --describe --topic fullstack --bootstrap-server localhost:90925. Send two messages to the fullstack topic:
bin/kafka-console-producer.sh --topic fullstack --bootstrap-server localhost:9092
>helloooooooooooo
>wordddddddddddd6. In another terminal, consume messages from the fullstack topic:
bin/kafka-console-consumer.sh --topic fullstack --from-beginning --bootstrap-server localhost:9092
helloooooooooooo
worddddddddddddThe consumer displays the sent messages, confirming successful production and consumption.
7. To stop Kafka, run:
bin/kafka-server-stop.sh config/server.propertiesFull-Stack Internet Architecture
Introducing full-stack Internet architecture technologies centered on Java
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.