Deleting a Kafka Topic
This document describes how to delete a topic.
Notes and Constraints
- Deleting a topic clears the topic data permanently.
- For an instance with ciphertext access enabled, if allow.everyone.if.no.acl.found is set to false, the topic can be deleted on the client only by the initial user (set in instance creation).
Prerequisite
The instance is in the Running state.
Deleting a Kafka Topic (Console)
- Log in to the console.
- Click
in the upper left corner to select the region where your instance is located.
- Click
in the upper left corner and choose Application > Distributed Message Service for Kafka to open the Kafka instance list.
- Click the desired instance to go to the instance details page.
- In the navigation pane, choose Instance > Topics.
- Delete topics using either of the following methods:
- Select one or more topics and click Delete Topic in the upper left corner.
- In the row containing the topic you want to delete, choose More > Delete.
- Click the name of the topic to be deleted. The topic details page is displayed. In the upper right corner, choose Delete.
- In the Delete Topic dialog box, click OK.
The topic is deleted if it is not displayed in the topic list.
Deleting a Kafka Topic on the Client
If your Kafka client version is later than 2.2, you can use kafka-topics.sh to delete topics.
- For a Kafka instance with ciphertext access disabled, run the following command in the /bin directory of the Kafka client:
./kafka-topics.sh --bootstrap-server {connection-address} --delete --topic {topic-name}
Table 1 Topic deletion parameters Parameter
Description
connection-address
Connection address of a Kafka instance. To obtain the address, choose Overview > Connection.
topic-name
Topic name.
Example:
[root@ecs-kafka bin]# ./kafka-topics.sh --bootstrap-server 192.168.xx.xx:9092,192.168.xx.xx:9092,192.168.xx.xx:9092 --delete --topic topic-01 [root@ecs-kafka bin]#
- For a Kafka instance with ciphertext access enabled, do as follows:
- (Optional) If the SSL certificate has been configured, skip this step and go to 2. Otherwise, do as follows:
Create the ssl-user-config.properties file in the /config directory of the Kafka client and add the SSL certificate configurations by referring to 3.
- Run the following command in the /bin directory of the Kafka client:
./kafka-topics.sh --bootstrap-server {connection-address} --delete --topic {topic-name} --command-config ../config/{ssl-user-config.properties}
Table 2 Topic deletion parameters Parameter
Description
connection-address
Connection address of a Kafka instance. To obtain the address, choose Overview > Connection.
topic-name
Topic name.
ssl-user-config.properties
Configuration file name. This file contains username, password, and SSL certificate information.
Example:
[root@ecs-kafka bin]# ./kafka-topics.sh --bootstrap-server 192.168.xx.xx:9093,192.168.xx.xx:9093,192.168.xx.xx:9093 --delete --topic topic-01 --command-config ../config/ssl-user-config.properties [root@ecs-kafka bin]#
- (Optional) If the SSL certificate has been configured, skip this step and go to 2. Otherwise, do as follows:
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot