Process Flow - Kafka CLI tools overview
Start Kafka CLI
Choose Tool
Producer
Send Msg
Show Output
End
This flow shows how you start Kafka CLI, pick a tool (producer, consumer, admin), perform actions, and see results.
kafka-console-producer --topic test
kafka-console-consumer --topic test --from-beginning
kafka-topics --list| Step | Command | Action | Result/Output |
|---|---|---|---|
| 1 | kafka-console-producer --topic test | Start producer to send messages | Ready to accept input for topic 'test' |
| 2 | Type 'Hello Kafka' | Send message to topic | Message 'Hello Kafka' sent |
| 3 | kafka-console-consumer --topic test --from-beginning | Start consumer to read messages | Reads messages from beginning of 'test' |
| 4 | Consumer outputs message | Display received message | 'Hello Kafka' displayed |
| 5 | kafka-topics --list | List all topics | Shows list including 'test' |
| 6 | Exit | Stop CLI tools | CLI session ends |
| Variable | Start | After Step 2 | After Step 4 | Final |
|---|---|---|---|---|
| Message Input | empty | 'Hello Kafka' | 'Hello Kafka' | session ended |
| Topic List | unknown | includes 'test' | includes 'test' | session ended |
Kafka CLI tools let you interact with Kafka from the command line. Use kafka-console-producer to send messages. Use kafka-console-consumer to read messages. Use kafka-topics to manage topics. Start tools, perform actions, see output, then exit.
kafka-topics.sh tool is used to manage topics including creation, deletion, and listing.--create with kafka-topics.sh creates a new topic.--bootstrap-server to specify the Kafka server address.kafka-console-producer.sh --bootstrap-server localhost:9092 --topic mytopic.test-topic has 3 messages: kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test-topic --from-beginning --max-messages 2?--max-messages option--max-messages 2 option limits the consumer to read only 2 messages before exiting.kafka-console-producer.sh --topic mytopic. What is missing?--bootstrap-server.--bootstrap-server, so it cannot connect and throws an error.localhost:9092. Which command correctly lists the topics?kafka-topics.sh tool manages topics and supports the --list option to show all topics.--bootstrap-server localhost:9092 specifies the Kafka server to connect to.Pass the test and this pattern moves unknown