Operations 5 min read

All Kafka Development Commands Explained – 2026 Edition

This guide walks through the essential Kafka command‑line tools for creating, listing, describing, and altering topics, producing and consuming messages, and managing consumer groups, providing concrete examples and key parameters for each operation.

Architect Chen
Architect Chen
Architect Chen
All Kafka Development Commands Explained – 2026 Edition

Kafka command‑line utilities for development and testing.

Create a Topic

kafka-topics.sh \
  --create \
  --topic order \
  --bootstrap-server localhost:9092 \
  --partitions 3 \
  --replication-factor 1

Core parameters: --topic: topic name --partitions: number of partitions --replication-factor: number of replicas --bootstrap-server: broker address

Resulting structure:

order-topic
├── Partition0
├── Partition1
└── Partition2

List all Topics

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

Typical output:

order-topic
user-topic
payment-topic

Describe Topic Details

kafka-topics.sh \
  --describe \
  --topic order \
  --bootstrap-server localhost:9092

Key fields:

PartitionCount

Leader

Replicas

ISR (in‑sync replicas)

ISR anomalies are a primary entry point for troubleshooting replica synchronization issues.

Increase Topic Partitions

kafka-topics.sh \
  --alter \
  --topic order \
  --partitions 6 \
  --bootstrap-server localhost:9092

Note: Kafka can only increase partitions; it cannot decrease them directly.

Delete a Topic

kafka-topics.sh \
  --delete \
  --topic order \
  --bootstrap-server localhost:9092

Deletion in production should be performed with caution; verify the topic list first.

Produce Messages

kafka-console-producer.sh \
  --topic order \
  --bootstrap-server localhost:9092

Example input:

order-1001
order-1002
order-1003

Messages are sent to order-topic.

Consume Messages

kafka-console-consumer.sh \
  --topic order \
  --bootstrap-server localhost:9092

The consumer continuously reads new messages.

Consume from the Beginning

kafka-console-consumer.sh \
  --topic order \
  --bootstrap-server localhost:9092 \
  --from-beginning

Useful for development testing, message loss investigation, and historical verification.

List Consumer Groups

kafka-consumer-groups.sh \
  --list \
  --bootstrap-server localhost:9092

Typical groups: order-service-group, payment-service-group, user-service-group.

Describe Consumer Group Consumption

kafka-consumer-groups.sh \
  --describe \
  --bootstrap-server localhost:9092 \
  --group order-service-group

Sample output shows each partition’s current offset, log end offset, and lag:

TOPIC           PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG
order-topic     0          1000            1050            50
order-topic     1          1200            1200            0
order-topic     2          900             1000            100
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

KafkaConsumerCommand LineProducerConsumer GroupTopic Management
Architect Chen
Written by

Architect Chen

Sharing over a decade of architecture experience from Baidu, Alibaba, and Tencent.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.