Using Kafka Command-line Tools
Kafka command-line tools are located in /usr/bin:
- kafka-topics
Create, alter, list, and describe topics. For example:
$ /usr/bin/kafka-topics --zookeeper zk01.example.com:2181 --list sink1 t1 t2 $ /usr/bin/kafka-topics --zookeeper zk01.example.com:2181 --create --topic
- kafka-console-consumer
Read data from a Kafka topic and write it to standard output. For example:
$ /usr/bin/kafka-console-consumer --zookeeper zk01.example.com:2181 --topic t1
- kafka-console-producer
Read data from standard output and write it to a Kafka topic. For example:
$ /usr/bin/kafka-console-producer --broker-list kafka02.example.com:9092,kafka03.example.com:9092 --topic t1
- kafka-consumer-offset-checker
Check the number of messages read and written, as well as the lag for each consumer in a specific consumer group. For example:
$ /usr/bin/kafka-consumer-offset-checker --group flume --topic t1 --zookeeper zk01.example.com:2181