- Check version
kafka-topics --version
- Create topic
kafka-topics --bootstrap-server 127.0.0.1:9092 --topic first-topic --create --partitions 3 --replication-factor 1
N.B.: With single node kafka, the replication factor can't be more than one.
- List topics
kafka-topics --bootstrap-server 127.0.0.1:9092 --list
- Describe topic
kafka-topics --bootstrap-server 127.0.0.1:9092 --topic first-topic --describe
- Delete topic
kafka-topics --bootstrap-server 127.0.0.1:9092 --topic second-topic --delete
- Publish messages
kafka-console-producer --bootstrap-server 127.0.0.1:9092 --topic first-topic
- Publish messages with acks=all
kafka-console-producer --bootstrap-server 127.0.0.1:9092 --topic first-topic --producer-property acks=all
- Consume messages
kafka-console-consumer --bootstrap-server 127.0.0.1:9092 --topic first-topic
- Consume messages from beginning
kafka-console-consumer --bootstrap-server 127.0.0.1:9092 --topic first-topic --from-beginning
- Consume messages with consumer group
kafka-console-consumer --bootstrap-server 127.0.0.1:9092 --topic first-topic --group my-first-application
- Lists
kafka-consumer-groups --bootstrap-server 127.0.0.1:9092 --list
- Describe
kafka-consumer-groups --bootstrap-server 127.0.0.1:9092 --group my-first-application --describe