<a id="kafka-manage-topics"></a>

# Manage Topics in Confluent Platform

This page describes how to create, edit, and delete Kafka topics in Confluent Platform using Control Center and the Confluent CLI.

For information about topic configuration parameters, see [Kafka Topic Configuration Reference for Confluent Platform](../installation/configuration/topic-configs.md#cp-config-topics).

<a id="kafka-create-topics"></a>

## Create topics

You can create topics using either Control Center or the Confluent CLI. When you create a topic, you can specify configuration settings that override the broker-level defaults.

### Control Center

To create a topic using Control Center:

1. Navigate to Control Center and select your cluster.
2. Click **Topics** in the navigation menu.
3. Click **+ Add topic**.
4. Enter a topic name. Topic names are case-sensitive.
5. Enter the number of partitions for the topic.

   #### NOTE
   The topic name and the number of partitions cannot be edited after the topic has been created.
6. Choose one of the following options:
   - Click **Create with defaults** to create the topic using default settings.
   - Click **Customize settings** to configure additional settings:
     - **Availability settings**: Choose an availability/durability option such as Balanced, Low, Maximum, Moderate, or Custom that defines the replication factor and minimum in-sync replicas.
     - **Storage settings**: Configure cleanup policy, retention time, and retention size.
     - **Message size**: Set the maximum message size in bytes.
     - **Expert settings**: Enable to manually configure additional topic-level configuration options.

     Then click **Save & create**.

For more information, see [Create Topics Using Control Center for Confluent Platform](https://docs.confluent.io/control-center/current/topics/create.html).

### Confluent CLI

To create a topic using the Confluent CLI, you must first authenticate with your cluster. For more information about authentication, see [Role-Based Access Control for Confluent Platform Quick Start](../security/authorization/rbac/rbac-cli-quickstart.md#rbac-cli-quickstart).

```bash
confluent kafka topic create <topic-name> \
  --url <kafka-rest-url> \
  --partitions <num-partitions> \
  --replication-factor <replication-factor> \
  --config <key>=<value>
```

Example to create a topic:

```bash
confluent kafka topic create my-topic \
  --url http://localhost:8090/kafka \
  --partitions 3 \
  --replication-factor 3 \
  --config retention.ms=604800000
```

#### NOTE
The Confluent CLI topic commands require authentication and may use different flags depending on your cluster configuration. For more information, see the [Confluent CLI documentation](https://docs.confluent.io/confluent-cli/current/command-reference/kafka/topic/confluent_kafka_topic_create.html).

### Configuration precedence when creating topics

When you create a topic, the configuration settings you specify at the topic level override the broker-level defaults. Understanding how broker-level configuration changes affect topics is important:

* **Existing topics with a topic-level configuration set:**
  These topics are not affected by broker-level configuration changes. Their retention and other settings remain as configured at the topic level.
* **Existing topics with no topic-level configuration set:**
  These topics are affected by broker-level configuration changes. They inherit the new broker-level default.
* **New topics created after a broker-level change:**
  These topics are affected by broker-level configuration changes. They inherit the new broker-level default unless you specify a topic-level override during creation.

For example, if you change the broker-level `log.retention.ms` configuration:

* Topics that already have `retention.ms` explicitly set at the topic level continue to use their configured value.
* Topics without a topic-level `retention.ms` setting start using the new broker-level default.
* Any new topics created after the change use the new broker-level default unless you specify a different `retention.ms` value when creating them.

For more information about topic configuration parameters, see [Kafka Topic Configuration Reference for Confluent Platform](../installation/configuration/topic-configs.md#cp-config-topics).

<a id="kafka-edit-topics"></a>

## Edit topics

You can edit topic configurations using either Control Center or the Confluent CLI.

### Control Center

To edit a topic using Control Center:

1. Navigate to Control Center and select your cluster.
2. Click **Topics** in the navigation menu.
3. Select the topic you want to edit.
4. Click the **Configuration** tab.
5. Click **Edit settings** and modify the configuration settings as needed.
6. Click **Save changes**.

For more information, see [Edit Topics Using Control Center for Confluent Platform](https://docs.confluent.io/control-center/current/topics/edit.html).

### Confluent CLI

To edit topic configuration, such as retention time:

```bash
confluent kafka topic update <topic-name> \
  --url <kafka-rest-url> \
  --config <key>=<value>
```

Example to change retention time:

```bash
confluent kafka topic update my-topic \
  --url http://localhost:8090/kafka \
  --config retention.ms=1209600000
```

To increase the number of partitions:

```bash
confluent kafka topic update <topic-name> \
--url <kafka-rest-url> \
--config num.partitions=<new-partition-count>
```

Example to increase partitions:

```bash
confluent kafka topic update my-topic \
--url http://localhost:8090/kafka \
--config num.partitions=6
```

#### NOTE
You can only increase the number of partitions for a topic. Decreasing partitions is not supported.

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

## Delete topics

You can delete topics using either Control Center or the Confluent CLI. Note that deleting a topic is a permanent action and cannot be undone. All data in the topic will be lost.

### Control Center

To delete a topic using Control Center:

1. Navigate to Control Center and select your cluster.
2. Click **Topics** in the navigation menu.
3. Select the topic you want to delete.
4. Click the **Configuration** tab.
5. Click **Delete topic**.
6. Enter the topic name and click **Continue**.

For more information, see [Delete Topics Using Control Center for Confluent Platform](https://docs.confluent.io/control-center/current/topics/delete.html).

### Confluent CLI

To delete a topic using the Confluent CLI:

```bash
confluent kafka topic delete <topic-name> \
  --url <kafka-rest-url>
```

Example to delete a topic:

```bash
confluent kafka topic delete my-topic \
  --url http://localhost:8090/kafka
```

## Related content

* [Kafka Topic Configuration Reference for Confluent Platform](../installation/configuration/topic-configs.md#cp-config-topics)
* [Best Practices for Kafka Production Deployments in Confluent Platform](post-deployment.md#kafka-post-deployment)
* [Control Center Documentation](https://docs.confluent.io/control-center/current/)
