0
0
Kafkadevops~30 mins

Topic deletion and cleanup in Kafka - Mini Project: Build & Apply

Choose your learning style9 modes available
Kafka Topic Deletion and Cleanup
📖 Scenario: You are managing a Kafka cluster that stores messages for different applications. Sometimes, old topics are no longer needed and should be deleted to free up space and keep the system clean.
🎯 Goal: You will learn how to delete a Kafka topic safely and verify that the topic has been removed from the cluster.
📋 What You'll Learn
Kafka cluster is running locally
Kafka command-line tools are available
Basic knowledge of terminal commands
💡 Why This Matters
🌍 Real World
Kafka topics store streams of data for applications. Removing unused topics helps keep the system clean and saves storage.
💼 Career
Kafka administrators and DevOps engineers often need to manage topics, including deleting old ones to maintain cluster health.
Progress0 / 4 steps
1
Create a Kafka topic named old_topic
Use the Kafka command-line tool to create a topic called old_topic with 1 partition and a replication factor of 1.
Kafka
Need a hint?

Use kafka-topics.sh --create with the right flags to create the topic.

2
Enable topic deletion in Kafka configuration
Set the Kafka broker configuration property delete.topic.enable to true to allow topic deletion.
Kafka
Need a hint?

Find the server.properties file and add or update delete.topic.enable=true. Restart Kafka after.

3
Delete the Kafka topic named old_topic
Use the Kafka command-line tool to delete the topic called old_topic.
Kafka
Need a hint?

Use kafka-topics.sh --delete --topic old_topic to remove the topic.

4
Verify that the topic old_topic is deleted
List all Kafka topics and confirm that old_topic no longer appears.
Kafka
Need a hint?

Use kafka-topics.sh --list and check that old_topic is not shown.