Kafka CLI Cheatsheet
Top commands.
Overview
The Kafka CLI cheatsheet captures the patterns operators actually use during Kafka investigation. Consumer lag is the metric that matters; topic configuration is where surprises live; fluency at the CLI shortens both diagnostic paths.
- Top commands.
kafka-topics,kafka-console-producer,kafka-console-consumer,kafka-consumer-groups; the four investigation paths. - Topic management. Create, delete, describe, alter; the topic config (partitions, retention, replication) is what determines behaviour.
- Consumer-group inspection. Lag, offsets, members; the lag number is the canary for consumer health.
- Console producer/consumer plus reassign. Ad-hoc message inspection for debugging; partition reassignment for rebalance.
The approach
The practical approach: consumer-group lag monitoring as default, console producer/consumer for debugging, kcat for power users. The team’s discipline produces fast investigation without console clicks.
- kafka-consumer-groups --bootstrap-server ... --describe --group g. Per-group lag and offsets; first call when consumers are behind.
- kafka-topics --describe --topic t. Topic configuration: partition count, replication factor, retention; surprises live here.
- kafka-console-consumer --from-beginning. Ad-hoc message inspection; the canonical debug path for "is the message what I expect?"
- kcat for power users. Faster, more flexible than the bundled tools; the right call for shell-pipeline integration.
- Document the cluster. Per-cluster topology committed to the repo; supports investigation under pressure.
Why this compounds
Kafka CLI fluency compounds across investigations. Each lag investigation teaches a consumer pattern; streaming expertise accrues; cost-per-incident falls as the team’s muscle grows.
- Faster Kafka debugging. Fluent CLI produces fast root cause; lag investigations resolve in minutes, not hours.
- Better consumer-group hygiene. Lag monitoring catches consumer issues before they become user-visible.
- Better topic management. CLI replaces UI clicks; topic operations become scriptable, reproducible, audit-friendly.
- Institutional knowledge. Each command teaches Kafka patterns; the team’s event-driven engineering muscle grows.
Kafka CLI fluency is an operational discipline that pays off across years. Nova AI Ops integrates with streaming telemetry, surfaces patterns, and supports the team’s event-driven discipline.