Kafka CLI tools is a command line interface used to interact with the Kafka server and get different types of information like topic details, consumer lag, offset reset information, etc. Let’s learn to install the Kafka Cli tool on your machine

Download the Kafka CLI Binary

Visit the Apache Kafka website and select any version to download the Kafka binary. we are selecting the latest available version.

https://kafka.apache.org/downloads

Please copy the file link and download it to any location on your machine. we are using the Linux Operating system so we will use the wget command to download the file

wget https://downloads.apache.org/kafka/3.7.0/kafka_2.13-3.7.0.tgz

You need to untar the file using the below command and this will create a new folder in the current directory.

tar -xvzf kafka_2.13-3.7.0.tgz  

Move to the bin folder and then list the files present in the directory and you will find all the CLI tools

cd kafka_2.13-3.7.0/bin/     
ll

You will get different CLI tools like

  • kafka-topics.sh
    • Use the kafka-topics tool to create or delete a topic. You can also use the tool to retrieve a list of topics associated with a Kafka cluster.
  • kafka-consumer-groups.sh
    • Use the kafka-consumer-groups tool to get a list of the active groups in the cluster.

Using the CLI tool

You need to use the ./ before any Kafka CLI tool. For example, if you want to use the kafka-topics.sh then you need to type the semantics as below

./kafka-topics.sh <provide-options>

References

Leave a Reply

Your email address will not be published. Required fields are marked *