Useful Commands and tools for Kafka

From Luis Gallego Hurtado - Not Another IT guy
Jump to: navigation, search


Utilities for Kafka


You can install Kafkacat with aptitude:

apt-get install kafkacat

Kafka useful commands

  • List all topics in cluster --list --zookeeper <COMMA_SEPARATED_LIST_OF_PAIRS_ZOOKEEPER_HOST:PORT>
  • Manually delete a topic <ZOOKEEPER_HOST:PORT>
rmr /brokers/topics/<TOPIC_NAME>
rmr /admin/delete_topics/<TOPIC_NAME>
  • Get all topic offsets --output-file <PATH_TO_DESTINATION_FILE> --zkconnect <ZOOKEEPER_HOST:PORT>
kafka-run-class --broker-list  <COMMA_SEPARATED_LIST_OF_PAIRS_KAFKA_BROKER_HOST:PORT> --topic <TOPIC_NAME>
  • List all consumer groups --list --bootstrap-server <COMMA_SEPARATED_LIST_OF_PAIRS_KAFKA_BROKER_HOST:PORT>
  • Describe a consumer group --describe --bootstrap-server <COMMA_SEPARATED_LIST_OF_PAIRS_KAFKA_BROKER_HOST:PORT> --group <GROUP_NAME>
  • Get the lag of different topics --broker-list  <COMMA_SEPARATED_LIST_OF_PAIRS_KAFKA_BROKER_HOST:PORT>