DevLearn
Command Reference

Kafka CLI Commands

Searchable library of Kafka CLI commands for daily operations

topics
create
topic
kafka-topics.sh --create --topic <topic-name> --bootstrap-server localhost:9092 --partitions <n> --replication-factor <n>

Create a new topic with specified partitions and replication factor

topics
list
topics
kafka-topics.sh --list --bootstrap-server localhost:9092

List all topics in the Kafka cluster

topics
describe
topic
kafka-topics.sh --describe --topic <topic-name> --bootstrap-server localhost:9092

Get detailed information about a topic configuration

topics
alter
partitions
kafka-topics.sh --alter --topic <topic-name> --bootstrap-server localhost:9092 --partitions <n>

Increase the number of partitions for a topic

topics
config
retention
kafka-configs.sh --alter --entity-type topics --entity-name <topic-name> --bootstrap-server localhost:9092 --add-config retention.ms=86400000

Update topic configuration (e.g., retention period)

Quick Tips

Replace <topic-name> with your actual topic name

Use tags to quickly find related commands

Commands shown for Linux/Mac. Use .bat extension for Windows