Kafka CLI tools written in Python for publish
and subscribe
message from Apache Kafka.
A similiar tool that i built with Golang
https://github.com/musobarlab/kafka-cli.
Manual install
$ git clone https://github.com/wuriyanto48/kafka-cli-py.git
$ pip install -r requirements.txt
$ python setup.py install
See available options
$ kafka-cli -h
$ kafka-cli pub --brokers localhost:9092 --topic topbanget1 --message "hello world"
$ kafka-cli pub --brokers localhost:9092 --topic topbanget1 --message '{"header":"JSON","content":"this is JSON message"}'
$ kafka-cli sub --brokers localhost:9092 --topic topbanget1
Multiple brokers
$ kafka-cli sub --brokers localhost:9092,localhost:9093,localhost:9094 --topic topbanget1
With auth mechanism
, you need to provide --auth
flag to prompt username and password
$ kafka-cli sub --brokers localhost:9092,localhost:9093,localhost:9094 --topic topbanget1 --auth
$ username: admin
$ password: adminpass
kafka-cli adm list-topic --brokers localhost:9092,localhost:9093,localhost:9094 --auth
$ kafka-cli adm create-topic --brokers localhost:9092,localhost:9093,localhost:9094 --topic topbanget1 --partition 3 --replication 3 --auth
$ kafka-cli adm delete-topic --brokers localhost:9092,localhost:9093,localhost:9094 --topic topic_name_to_delete --auth
$ kafka-cli adm add-partition --brokers localhost:9092,localhost:9093,localhost:9094 --topic existing_topic_name --partition 3 --auth