Create a Topic
kafka-topics --bootstrap-server localhost:9092 --create --topic <topic_name> --partitions <number_of_partitions> --replication-factor <replication_factor>
Description: Create a new topic with specified partitions and replication factor.
Delete a Topic
kafka-topics --bootstrap-server localhost:9092 --delete --topic <topic_name>
Description: Delete a specific topic from the Kafka cluster.
List All Topics
kafka-topics --bootstrap-server localhost:9092 --list
Description: Display a list of all topics in the Kafka cluster.
Describe Topic Partitions
kafka-topics --bootstrap-server localhost:9092 --describe --topic <topic_name>
Description: Show partition details (e.g., leader, replicas) for a specific topic.
Consume First N Messages
kafka-console-consumer --bootstrap-server localhost:9092 --topic <topic_name> --from-beginning --max-messages N
Description: Read the first N messages from the beginning of a topic.
Consume Messages from Offset
kafka-console-consumer --bootstrap-server localhost:9092 --topic <topic_name> --partition <partition> --offset <begin_from> --max-messages <messages_count>
Description: Read a specific number of messages starting from a given offset in a partition.
List Consumer Groups
kafka-consumer-groups --bootstrap-server localhost:9092 --list
Description: List all active consumer groups in the Kafka cluster.
Describe All Consumer Groups
kafka-consumer-groups --bootstrap-server localhost:9092 --describe --all-groups
Description: Display details (e.g., offsets, lag) for all consumer groups.
Describe Specific Consumer Group
kafka-consumer-groups --bootstrap-server localhost:9092 --describe --group <group_name>
Description: Show partition consumption details for a specific consumer group.
Produce a Test Message
kafka-console-producer --bootstrap-server localhost:9092 --topic <topic_name>
Description: Send test messages to a topic by typing text interactively.
Produce Messages with Keys
kafka-console-producer --bootstrap-server localhost:9092 --topic <topic_name> --property "parse.key=true" --property "key.separator=:"
Description: Produce messages with a key-value format using a specified separator.
View Cluster API Versions
kafka-broker-api-versions --bootstrap-server localhost:9092
Description: Show supported Kafka API versions for all brokers in the cluster.