<a id="delete-topics-c3"></a>

# Delete Topics Using Control Center for Confluent Platform

#### NOTE
If [Manage RBAC roles with Control Center on Confluent Platform](../security/c3-rbac-manage-roles-ui.md#c3-rbac-manage-roles-ui)
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

1. Select a cluster from the navigation bar.
2. Click the **Topics** cluster submenu. The Topics page appears.
3. Click the link for the topic name. The Overview page appears.
4. Click the **Configuration** tab.
5. Click **Edit settings** -> **Delete topic**.
6. Confirm the topic deletion by typing the topic name and
   click **Continue**.

<a id="bulk-delete-topics-c3"></a>

## 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, and can
result in unexpected behavior if you delete the wrong topics.
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:

```bash
{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.

![Topics associated with an older and current version of Control Center](images/c3-old-new-internal-topics.png)

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:

1. Make sure Control Center version 6.2 or later is up and running.
2. Navigate to your Confluent home directory and run the script with the following command,
   passing the properties file for the current instance:
   ```bash
   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:
   ```bash
   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
   ```
3. Type `y` to clean up old instances, or type `N` to receive prompts to complete the
   cleanup process for one instance at a time. For example:
   ```bash
   Do you want to cleanup _confluent-controlcenter-6-1-0-1 ? [y/N/dryRun]:
   ```
4. 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:
   ```bash
   Finished dryRun for _confluent-controlcenter-6-1-0-1 . Do you want to clean it up? [y/N/dryRun]:
   ```

<a id="delete-topics-internal-c3"></a>

## Delete a single internal topic

With each version upgrade or ID change, Control Center (running in [Normal mode](../overview.md#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.
You may be directed to delete these topics by
[Confluent Support](https://support.confluent.io) or may need to delete them to clean up disk space.

The preferred method to delete old internal topics is to use the [deletion script](#bulk-delete-topics-c3) provides a safer way to
bulk-detect and delete internal topics that are no longer in use.

To delete a single internal topic:

1. Select a cluster from the navigation bar.
2. Click the **Topics** cluster submenu. The All topics page appears.
3. Click the **Hide internal topics** toggle to off to unhide internal topics.
   Internal topics are prefixed with an underscore.
   ![Show internal topics in Confluent Control Center](images/c3-topics-show-internal.png)
4. Click the link for the topic name that you want to delete. The Overview page
   appears.
5. Click the **Configuration** tab.
6. Click **Edit settings** -> **Delete topic**. You are prompted to type the
   topic name to confirm deleting the topic.
7. Select the check box to acknowledge your awareness that you are deleting an
   internal topic and its possible ramifications.
   ![Confirm delete internal topic in Confluent Control Center](images/c3-confirm-internal-delete-topic.png)
8. Click **Continue**. The topic is marked for deletion.

   To cancel deleting the topic, click **Cancel**.
