Kaf: useful kafka cli

Kafka is the leading distributed Log OSS solution. It is great to inject large amounts of data and is used by many companies nowadays. Kafka is used in many use cases like Data Injection, Stream/Batch processing, Microservices CQRS, and ES and many others. Some years ago a showed how to get started with Kafka. Now I want to share a pretty useful and simple tool called Kaf. Kaf is written in Go language and was inspired by Docker and Kubectl. Today I will how to download and use Kaf. Have fun.



Kaf: Kafka CLI

Install Kaf

curl https://raw.githubusercontent.com/infinimesh/kaf/master/godownloader.sh | BINDIR=$HOME/bin bash
kaf config add-cluster local -b localhost:9092
kaf config select-cluster

Start Zookeper and Kafka

bin/zookeeper-server-start.sh config/zookeeper.properties
bin/kafka-server-start.sh config/server.properties

Create Topic

sudo bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test

Use Kaf

 kaf node ls
ID    ADDRESS       
0     4winds:9092
kaf topics
NAME   PARTITIONS   REPLICAS   
test   1            1   
kaf topics describe test
NAME   PARTITIONS   REPLICAS   
test   1            1  
 echo "works" | kaf produce test
 echo "{\"values:\": [1,2,3,4,5,6]}" | kaf produce test
kaf consume test
works

{
  "values:": [
    1,
    2,
    3,
    4,
    5,
    6
  ]
}


Cheers,
Diego Pacheco

Popular posts from this blog

Having fun with Zig Language

C Unit Testing with Check

Cool Retro Terminal