Kafka is a distributed message broker that is used to handle large amounts of data in real-time. In this tutorial, we will show you how to install Kafka on Debian latest.
Before we begin, ensure that your system meets the following requirements:
You must have Java installed on your system to run Kafka. You can check if Java is already installed by running the following command:
java -version
If Java is not installed, you can install OpenJDK 8 with the following command:
sudo apt-get update
sudo apt-get install openjdk-8-jdk
Verify that Java is installed by running the java -version
command again.
Next, download the latest version of Kafka from the Kafka official website by running the following command:
wget https://downloads.apache.org/kafka/2.8.1/kafka_2.12-2.8.1.tgz
Once the download is complete, you need to extract the tar file with the following command:
tar -xzf kafka_2.12-2.8.1.tgz
You can start the Kafka server by navigating to the extracted Kafka directory and starting the server using the following command:
cd kafka_2.12-2.8.1
./bin/kafka-server-start.sh config/server.properties
This will start the Kafka server on the default port 9092.
To create a new topic, open a new terminal window and navigate to the Kafka directory. Use the following command to create a new topic:
./bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test-topic
This will create a new topic named test-topic
.
Now that you have created a Kafka topic, you can start producing and consuming messages. In a new terminal window, use the following command to start producing messages:
./bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test-topic
In another terminal window, use the following command to start consuming messages:
./bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test-topic --from-beginning
This will start printing the messages that have been produced in the previous terminal window.
By following the above steps, you have successfully installed and configured a Kafka server on Debian Latest. You can now create and manage Kafka topics and produce and consume messages.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!