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.

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.

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.

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.

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:

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.

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.

Edit topics

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

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.

To edit topic configuration, such as retention time:

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

Example to change retention time:

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

To increase the number of partitions:

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

Example to increase partitions:

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.

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.

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.

To delete a topic using the Confluent CLI:

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

Example to delete a topic:

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