Apache Kafka Tutorial 0/111 lessons ~6 min read Lesson 14
Kafka CLI Basics
What is Kafka CLI Basics?
Course progress0%
Focus
9 guided sections
Practice signal
Examples included
Career prep
Foundation builder
Introduction
What is Kafka CLI Basics? Kafka CLI tools create topics, inspect groups, produce test records, consume streams, and debug metadata.
Understanding the topic
What happens — Kafka CLI Basics:
- kafka-topics: create and describe topics.
- kafka-console-producer/consumer: quick tests.
- kafka-consumer-groups: inspect lag.
- Use CLI to debug before changing code.
| Term | Description |
|---|---|
| kafka-topics | Topic admin. |
| kafka-console-producer | Send test messages. |
| kafka-console-consumer | Read messages. |
| kafka-consumer-groups | Group lag and offsets. |
Visual explanation
Pipeline view:
text
Input topic↓filter/map/join/window↓state store + changelog↓output topic
Step-by-step explanation
- Create topic — partitions + RF.
- Produce test — console producer.
- Consume — from-beginning.
- Inspect group — --describe lag.
Informative example
Example:
bash
kafka-topics --bootstrap-server localhost:9092 --create --topic payments --partitions 6 --replication-factor 3kafka-console-producer --bootstrap-server localhost:9092 --topic paymentskafka-console-consumer --bootstrap-server localhost:9092 --topic payments --from-beginningkafka-consumer-groups --bootstrap-server localhost:9092 --describe --group payments-service
Execution workflow
1Kafka CLI Basics workflow
1 / 4Create topic
partitions + RF.
Best practices
- Choose keys before joins and aggregations.
- Name internal topics and state stores clearly.
- Test topology with realistic ordering and late events.
- Monitor processing latency, commit rate, and restore time.
Common mistakes
- Unexpected repartition topics from wrong key choices.
- Ignoring late-arriving events in windows.
- Underestimating state-store disk and restore time.
Summary
Kafka CLI Basics — Design topology around keys, state stores, window boundaries, changelog topics, and exactly-once needs.
Ready to mark this lesson complete?Track your journey across the entire course.