DEV Community

Hisyam Johan
Hisyam Johan

Posted on

Install Kafka on CentOS 7

Bismillah

Prerequisite:

  1. Java 1.8

Installation:

  1. Download Kafka
    wget https://mirrors.estointernet.in/apache/kafka/2.8.1/kafka_2.13-2.8.1.tgz

  2. Extract downloaded zip
    tar -xzf kafka_2.13-2.8.1.tgz

  3. Create symlink
    ln -s kafka_2.13-2.8.1 kafka

  4. Export
    echo "export PATH=$PATH:/root/kafka__2.13-2.8.1/bin" >> ~/.bash_profile
    source ~/.bash_profile

  5. Run zookeeper

cd kafka/bin
./zookeeper-server-start.sh -daemon ~/kafka/config/zookeeper.properties
#check if zookeeper successfully running
telnet localhost 2181
# install telnet if not available (optional)
yum -y install telnet-server telnet
Enter fullscreen mode Exit fullscreen mode
  1. Run kafka
./kafka-server-start.sh -daemon ~/kafka/config/server.properties
#check if kafka successfully running
telnet localhost 9092
Enter fullscreen mode Exit fullscreen mode

Now you are done install kafka on CentOS 7

Optional

  1. Create kafka topic
    ./kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic my-topic

  2. List created topic
    ./kafka-topics.sh --zookeeper localhost:2181 --list

Alhamdulillah

Top comments (0)