Welcome to this hands-on tutorial where you’ll learn how to manage topics, partitions, and brokers in Apache Kafka. By the end of this lesson, you’ll know how to create topics with custom partitions and replication, inspect topic metadata, and update topic configurations.Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
1. Exploring the Kafka Installation
Begin by navigating to your Kafka home directory and listing its contents:bin/:
| Script | Purpose |
|---|---|
| kafka-topics.sh | Create, list, and delete topics |
| kafka-console-producer.sh | Publish messages to a topic |
| kafka-console-consumer.sh | Consume messages from a topic |
| kafka-configs.sh | Alter configuration of brokers/topics |
| kafka-broker-api-versions.sh | List broker API versions |
2. Creating a Simple Topic
To create a topic nameddemo_topic, run:
You can verify the new topic in the Kafdrop UI under Topics. By default, a new topic has 1 partition and a replication factor of 1.
3. Creating a Partitioned and Replicated Topic
Partitions enable parallel message processing, while replication provides fault tolerance. In production, set partitions to match your consumer groups and replication factor to at least 2 or 3.A low replication factor (e.g., 1) has no redundancy. If the single broker fails, data becomes unavailable.
partitioned_topic with 3 partitions and a replication factor of 1:

4. Describing a Topic via CLI
To inspect partition details, use:5. Altering Topic Configuration
Adjust the retention period forpartitioned_topic to 48 hours (172,800,000 ms):

Configs: retention.ms=172800000.
6. Listing Brokers in the Cluster
To view the broker API versions and ensure your brokers are reachable:Next up: configuring producers and consumers for message publishing and consumption.