Delete topic on Kafka, 카프카 토픽 삭제하기

To delete a topic in Kafka, you need to ensure that the Kafka cluster is properly configured to allow topic deletions and then execute the deletion command. Here's a step-by-step guide on how to do this:

1. Enable Topic Deletion in Kafka (if not already enabled)

By default, Kafka does not always enable topic deletion. You need to ensure that the Kafka broker has the following setting in the configuration file (server.properties):

delete.topic.enable=true

This setting allows topics to be deleted. If it is set to false, topic deletion will not work. You must restart the Kafka broker after making this change.

2. Delete a Topic Using Kafka Command-Line Tools

Once topic deletion is enabled, you can delete a Kafka topic using the Kafka command-line tool (kafka-topics.sh or kafka-topics.bat for Windows).

Example:

$ kafka-topics.sh --bootstrap-server localhost:9092 --delete --topic <topic_name>

Replace <topic_name> with the actual name of the topic you want to delete.

3. Check the Status of the Topic

You can verify if the topic has been successfully deleted by listing all topics:

$ kafka-topics.sh --bootstrap-server localhost:9092 --list

If the topic deletion was successful, it should no longer appear in the list.

4. Possible Delayed Deletion

In some cases, the topic may not be deleted immediately because Kafka marks it for deletion and it could take some time. The topic metadata will include a marker indicating that it's scheduled for deletion.

You can check the Kafka logs for deletion progress or check the status of the topic with the following command:

$ kafka-topics.sh --bootstrap-server localhost:9092 --describe --topic <topic_name>

If the topic is marked for deletion, it will be reflected in the metadata.

Notes:

  • Make sure the topic is not actively being used before attempting to delete it.
  • If Kafka’s delete functionality is disabled or misconfigured, you might see errors, or the topic might not get deleted.

댓글

이 블로그의 인기 게시물

Using the MinIO API via curl

vsftpd default directory

[Ubuntu] *.deb 파일 설치 방법

Offset out of range error in Kafka, 카프카 트러블슈팅

리눅스 (cron - 주기적 작업실행 데몬)

리눅스 (하드링크&소프트링크)

CDPEvents in puppeteer

Using venv in Python