Topic
Create kafka topic
bin/kafka-topics.sh --bootstrap-server <bootstrap-servers> --create --replication-factor 3 --partitions 3 --topic <topic>
List all available kafka topics
bin/kafka-topics.sh --bootstrap-server <bootstrap-servers> --list
Alter or modify topic partitions
bin/kafka-topics.sh --bootstrap-server <bootstrap-servers> --alter --topic <topic-name> --partitions 6
Send messages to kafka topic
bin/kafka-console-producer.sh --broker-list <bootstrap-servers> --topic <topic-name>
Changing the retention period for a topic
bin/kafka-topics.sh --bootstrap-server <bootstrap-servers> --alter --topic <topic-name> config retention.ms=360000*
Deleting a Kafka topic
bin/kafka-topics.sh --bootstrap-server <bootstrap-servers> --delete --topic <topic-name>
Messages
Consume messages or listen to kafka topic
bin/kafka-console-consumer.sh --bootstrap-server <bootstrap-servers> --topic <topic-name>
Consume messages from topic with group
bin/kafka-console-consumer.sh --topic <topic-name> --bootstrap-server <bootstrap-servers> --group <group-name>
Consume messages from the beginning of topic with group
bin/kafka-console-consumer.sh --topic <topic-name> --bootstrap-server <bootstrap-servers> --group <group-name> --from-beginning
Consume messages with header and keys
bin/kafka-console-consumer.sh --bootstrap-server <bootstrap-servers> --topic <topic-name> --property print.key=true --property print.headers=true --property print.timestamp=true
Commands Cheat Sheet
A vast collection of cheatsheets from popular tools and technologies with quick search functionlity and customizability
Query
Search for any commands from the list of tools and technologies as a whole from the All section or dedicated sections for each tool.Tools/Technologies
Cheat sheets or commands from Docker, Kubernetes, Kafka, Redis, Git, Curl, SSH & SCP, Helm are provided. More will be added shorly.Subsection
The command subsection is provided on the top right cornerAdd new commands
Add new commands by clicking on the "Add New Command" button. In the wizard which opens up, select any exisitng categories or type (and press enter) to add new categories. Add subsections if needed in the next step. In the next step, add a meaningful description of the command which would help in searching. In the final step, enter the command you want to save.Newly created categories would be added as buttons along with the existing categories.