Delete Topics¶
Note
If RBAC is enabled, you must have permissions to delete a topic. Contact your RBAC system administrator.
You can manually delete topics in the Control Center UI or bulk delete internal topics with a script.
When you make a delete request for a topic in the UI, the topic is marked for deletion. The topic is not deleted immediately unless it does not contain any data, such as a newly created topic. In addition, you cannot recreate a topic with the same name as the topic marked for deletion until the original topic and its data has finished being deleted.
Delete a single topic¶
- Select a cluster from the navigation bar.
- Click the Topics cluster submenu. The Topics page appears.
- Click the link for the topic name. The Overview page appears.
- Click the Configuration tab.
- Click Edit settings -> Delete topic.
- Confirm the topic deletion by typing the topic name and click Continue.
Delete a single internal topic¶
With each version upgrade or ID change, Control Center (running in Normal mode) creates a new set of internal topics that correspond to the new Control Center instance. These old topics are not used by the new Control Center instance, but they continue to take up disk space. As a result, you might need to delete these internal topics, especially if directed to by Confluent Support.
Select a cluster from the navigation bar.
Click the Topics cluster submenu. The All topics page appears.
Click the Hide internal topics toggle to off to unhide internal topics. Internal topics are prefixed with an underscore.
Click the link for the topic name that you want to delete. The Overview page appears.
Click the Configuration tab.
Click Edit settings -> Delete topic. You are prompted to type the topic name to confirm deleting the topic.
Select the check box to acknowledge your awareness that you are deleting an internal topic and its possible ramifications.
Caution
Deleting an internal topic could adversely impact your Confluent Platform installation. If in doubt, consult Confluent Support.
Click Continue. The topic is marked for deletion.
To cancel deleting the topic, click Cancel.
Bulk delete internal topics¶
Upgrading the Control Center version or changing the instance ID can result in a large number
of outdated internal topics. Manual deletion of these topics can be time consuming.
To save time, you can use a cleanup script called control-center-cleanup
to delete
topics associated with an older instance of Control Center.
The script is located in the bin directory under your Confluent home directory:
{CONFLUENT_HOME}/bin/control-center-cleanup
The following image shows an old set of internal topics prefixed with
_confluent-controlcenter-6-1-0-1
and a new set prefixed with _confluent-controlcenter-6-2-0-1
after Control Center was upgraded from version from 6.1.0 to 6.2.0.
The script is interactive, and you can delete internal topics with the script while Control Center is running. The script reads the properties file and determines the following:
- The name of the running instance from the
confluent.controlcenter.name
property. - The Control Center version running based on the current package where you are running the script.
- The instance identifier from the
confluent.controlcenter.id
property value. - The directory that contains data for Control Center from the
confluent.controlcenter.data.dir
property value.
To run the cleanup script:
Make sure Control Center version 6.2 or later is up and running.
Navigate to your Confluent home directory and run the script with the following command, passing the properties file for the current instance:
control-center-cleanup etc/confluent-control-center/control-center.properties
The script determines the current version and looks for older versions. If you have files for an older version, you will get output similar to the following:
The cleanup script found the following instance: _confluent-controlcenter-6-2-0-1 We believe this COULD be the instance defined in your config file so it will not be prompted for cleanup. Here are the instances discovered for cleanup: _confluent-controlcenter-6-1-0-1 Cleanup ALL of the instances above? [y/N]: N
Type
y
to clean up old instances, or typeN
to receive prompts to complete the cleanup process for one instance at a time. For example:Do you want to cleanup _confluent-controlcenter-6-1-0-1 ? [y/N/dryRun]:
Type
dryRun
and the script output lists all of the files that will be deleted. You are then prompted to clean up this instance (y
) or move to the next instance (N
). For example:Finished dryRun for _confluent-controlcenter-6-1-0-1 . Do you want to clean it up? [y/N/dryRun]:
For more information about how to use the cleanup script, see Removing Residue Data with Control Center Cleanup Script (blog post).