C
ClearView News

How do I delete a topic in Kafka?

Author

James Holden

Published Feb 15, 2026

How do I delete a topic in Kafka?

Use kafka-topics.sh --delete to delete remove-me topic. $ ./bin/kafka-topics.sh --zookeeper localhost:2181 --delete --topic remove-me Topic remove-me is marked for deletion. Note: This will have no impact if delete.

Similarly, how do you delete a topic?

  1. Go to Forums. Select the Forums tool from the Tool Menu of your site.
  2. Select Delete Topic from the drop-down menu. Zoom.
  3. You can also click on the title of a topic to select it. Zoom.
  4. Then click Delete Topic from within that topic. Zoom.
  5. Confirm deletion. Zoom.

Similarly, how do you set delete topic enable to true in Kafka? You have to set delete. topic. enable to true in config/server. properties before issuing this delete-topic command, otherwise, Kafka ignores the command you submit and does nothing for the topic.

Also asked, how do I delete data in Kafka?

1. stop zookeeper & Kafka server, 2. then go to 'kafka-logs' folder , there you will see list of kafka topic folders, delete folder with topic name 3. go to 'zookeeper-data' folder , delete data inside that.

How do you create a topic in Kafka?

Quickstart

  1. Step 1: Download the code. Download the 2.5.
  2. Step 2: Start the server.
  3. Step 3: Create a topic.
  4. Step 4: Send some messages.
  5. Step 5: Start a consumer.
  6. Step 6: Setting up a multi-broker cluster.
  7. Step 7: Use Kafka Connect to import/export data.
  8. Step 8: Use Kafka Streams to process data.

Where are Kafka topics stored?

properties you'll find a section on "Log Basics". The property log. dirs is defining where your logs/partitions will be stored on disk. By default on Linux it is stored in /tmp/kafka-logs .

How do I rename a Kafka topic?

Renaming a topic is not a supported operation. However, the latest Kafka versions now support topic deletion. So you can simply delete the old topic, and create a new one with the new name. If you had data you want to save, you can also use mirrormaker to copy data from the old topic to the new one.

What is Kafka topic?

Kafka Topic. A Topic is a category/feed name to which records are stored and published. As said before, all Kafka records are organized into topics. Producer applications write data to topics and consumer applications read from topics.

How can I see Kafka topics?

  1. To start the kafka: $ nohup ~/kafka/bin/kafka-server-start.sh ~/kafka/config/server.properties > ~/kafka/kafka.log 2>&1 &
  2. To list out all the topic on on kafka; $ bin/kafka-topics.sh --list --zookeeper localhost:2181.
  3. To check the data is landing on kafka topic and to print it out;

Does Kafka create topic automatically?

topics. enable property controls when Kafka enables auto creation of topic on the server. If this is set to true, when applications attempt to produce, consume, or fetch metadata for a non-existent topic, Kafka will automatically create the topic with the default replication factor and number of partitions.

How uninstall Kafka Linux?

Method 1: Uninstall Kafka 0.2.
When a new piece of program is installed on your system, that program is added to the list in Programs and Features. When you want to uninstall the program, you can go to the Programs and Features to uninstall it. So when you want to uninstall Kafka 0.2.

What is __ Consumer_offsets topic in Kafka?

2. 46. __consumer_offsets is used to store information about committed offsets for each topic:partition per group of consumers (groupID). It is compacted topic, so data will be periodically compressed and only latest offsets information available. _schema - is not a default kafka topic (at least at kafka 8,9).

How does Kafka retention work?

A message sent to a Kafka cluster is appended to the end of one of the logs. The message remains in the topic for a configurable period of time or until a configurable size is reached until the specified retention for the topic is exceeded. The message stays in the log even if the message has been consumed.

How do you stop Kafka?

Go to the Kafka home directory and execute the command ./bin/kafka-server-start.sh config/server. properties . Stop the Kafka broker through the command ./bin/kafka-server-stop.sh .

What is lag in Kafka?

The difference is called Lag, and represents how far the Consumer Group application is behind the producers. Producer offsets are kept in the Kafka Broker in charge of that partition, which can tell you the last offset in the partition. Total lag is the number of messages behind real time.

What is retention period in Kafka?

If the log retention is set to five days, then the published message is available for consumption five days after it is published. After that time, the message will be de discarded to free up space. The performance of Kafka is not affected by the data size of messages, so retaining lots of data is not a problem.

How do I restart my Kafka broker?

Make sure that the cluster is in a healthy state Make sure that the cluster is healthy before the rolling restart is started; confirm that no broker has under replicated partitions. Restart one broker (do not start with the broker who is the controller) Begin the rolling restart by restarting one broker.

How do I reset a Kafka topic?

Stop the Apache Kafka daemon for each broker ID listed. Connect to each broker, and delete the topic data folder, e.g. rm -rf /tmp/kafka-logs/MyTopic-0 . Repeat for other partitions, and all replicas. Delete the topic metadata: zkCli.sh then rmr /brokers/MyTopic.