apache-kafka kafka console tools kafka-topics


Example

This tool let you list, create, alter and describe topics.

List topics:

kafka-topics  --zookeeper localhost:2181 --list

Create a topic:

kafka-topics  --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test

creates a topic with one partition and no replication.

Describe a topic:

kafka-topics  --zookeeper localhost:2181 --describe --topic test

Alter a topic:

# change configuration
kafka-topics  --zookeeper localhost:2181 --alter --topic test --config max.message.bytes=128000
# add a partition
kafka-topics  --zookeeper localhost:2181 --alter --topic test --partitions 2

(Beware: Kafka does not support reducing the number of partitions of a topic) (see this list of configuration properties)