in DevOps

Some Kafka Command line Examples

You may download latest kafka source from .

Kafka command-line tools are located in bin/ of source directory.


Create, alter, list, and describe topics. For example.

# List topics
$ ./bin/ --zookeeper --list

# Create a new topics
$ ./bin/ --create --zookeeper --replication-factor 2 
  --partitions 1 --topic topicname 

# Describe a topic
$ ./bin/ --zookeeper --describe --topic topicname



Read data from a Kafka topic and write it to standard output. For example.

$ ./bin/ --zookeeper --topic test-topic

Note: To consumes events from beginning can append --from-beginning .



Read data from standard output and write it to a Kafka topic. For example.

$ ./bin/ --broker-list, --topic test-topic