Installing Kafka on OpenSUSE
Apache Kafka is a distributed streaming platform that allows you to publish and subscribe to messages in real time. In this tutorial, you will learn how to install Kafka on OpenSUSE.
Prerequisites
Before you start, make sure you have the following:
- OpenSUSE Latest installed
- Java 8 or higher
Step 1: Download Kafka
The first step is to download Kafka from the official website: http://kafka.apache.org/downloads
You will need to choose the version you want to install, in our case we will choose version 2.8.0. Once you have clicked on the link, your download will start automatically.
$ wget https://dlcdn.apache.org/kafka/2.8.0/kafka_2.13-2.8.0.tgz
Step 2: Extract Kafka
Once the download is completed, you will have a compressed file. Extract the file using the following command:
$ tar -xzf kafka_2.13-2.8.0.tgz
Step 3: Start Kafka services
Next, go to the Kafka directory and start the services. Kafka uses ZooKeeper to manage the brokers, so you will need to start ZooKeeper first:
$ cd kafka_2.13-2.8.0
$ bin/zookeeper-server-start.sh config/zookeeper.properties
Once ZooKeeper is up and running, open a new terminal window and start the Kafka broker:
$ bin/kafka-server-start.sh config/server.properties
Step 4: Verify Kafka is running
To verify that Kafka is running, you can create a test topic and publish a message to it. In a new terminal window, create a topic:
$ bin/kafka-topics.sh --create --topic my-topic --bootstrap-server localhost:9092
Next, publish a message to the topic:
$ bin/kafka-console-producer.sh --topic my-topic --bootstrap-server localhost:9092
Enter a message and hit Enter.
In another terminal window, subscribe to the topic and receive the message:
$ bin/kafka-console-consumer.sh --topic my-topic --from-beginning --bootstrap-server localhost:9092
You should see the message that you published.
Conclusion
Congratulations! You have successfully installed Kafka on OpenSUSE and verified that it is running. You can now use Kafka to publish and subscribe to messages in real time.