Install and Setup Kafka on Linux: -
JDK 8 and above
Steps to Install Kafka on Linux
Step1: Download Apache kafka latest version
Once your download is complete, unzip the file’s contents using tar, a file archiving tool and rename the folder to kafka
Step2: Extract tar file and rename
$sudo tar -xzf kafka_2.13-2.8.0.tgz
$sudo mv kafka_2.13-2.8.0 kafka
Step3: Set Kafka home and PATH environment variable on .bashrc or .profile file.
Save and Quit
Step4: Now reload the environment variables to the opened session by running below command.
In case if you have added path to .profile file then restart your session by logging out and logging in again.
Step5: Start Zookeeper
ZooKeeper is a high-performance coordination service for distributed applications and Kafka uses ZooKeeper to store the metadata information of the cluster. Kafka comes with the Zookeeper built-in, all we need is to start the service with default configuration.
Step6: Start Kafka Broker
A Kafka cluster consists of one or more brokers (Kafka servers) and broker organizes messages to respective topics and persists all the Kafka messages in a topic log file for 7 days. Depends on your replication factor of the topic, the messages are replicated to multiple brokers.
Open another ubuntu session/terminal and start Kafka server with default configuration.