Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
** xref:manage:cluster-maintenance/index.adoc[Cluster Maintenance]
*** xref:manage:cluster-maintenance/cluster-property-configuration.adoc[]
*** xref:manage:cluster-maintenance/node-property-configuration.adoc[]
*** xref:manage:cluster-maintenance/topic-property-configuration.adoc[]
*** xref:manage:cluster-maintenance/cluster-balancing.adoc[]
*** xref:manage:cluster-maintenance/continuous-data-balancing.adoc[Continuous Data Balancing]
*** xref:manage:cluster-maintenance/decommission-brokers.adoc[Decommission Brokers]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
= Configure Topic Properties
:description: Learn how to configure topic properties to control Redpanda's behavior for individual topics, including retention, cleanup policies, and Tiered Storage settings.
:page-categories: Management

Topic properties control Redpanda's behavior for individual topics, including data retention, cleanup policies, compression settings, and Tiered Storage configurations. These properties let you customize how Redpanda stores, processes, and manages data for each topic, overriding cluster-wide defaults when needed.

Redpanda stores topic properties as metadata associated with each topic and replicates them across the cluster to ensure consistency. Many topic properties correspond to xref:manage:cluster-maintenance/cluster-property-configuration.adoc[cluster properties] that establish default values for all topics. When you set a topic property, it overrides the corresponding cluster default for that specific topic.

NOTE: All topic properties take effect immediately after being set.

For a complete reference of available topic properties and their corresponding cluster properties, see xref:reference:properties/topic-properties.adoc[Topic Configuration Properties].

== Configuration methods

You can configure topic properties through multiple interfaces:

* **rpk commands** - Use xref:reference:rpk/rpk-topic/rpk-topic-create.adoc[`rpk topic create`] with the `-c` flag to set properties during topic creation, or xref:reference:rpk/rpk-topic/rpk-topic-alter-config.adoc[`rpk topic alter-config`] to modify existing topics.
* **Kafka Admin API** - Any Kafka-compatible client can use the standard Admin API to configure topic properties.
* **Kubernetes Topic resources** - In Kubernetes deployments, configure topic properties using the `additionalConfig` field in Topic resources. See xref:manage:kubernetes/k-manage-topics.adoc[Manage Topics in Kubernetes].
* **Redpanda Console** - Use the web interface to xref:console:ui/edit-topic-configuration.adoc[edit topic configuration] through a graphical interface.

== Verify topic property configuration

The `SOURCE` output of the xref:reference:rpk/rpk-topic/rpk-topic-describe.adoc[`rpk topic describe <topic>`] command shows how properties are configured for the topic:

* `DEFAULT_CONFIG` is set by a Redpanda default.
* `DYNAMIC_TOPIC_CONFIG` is set by the user specifically for the topic and overrides inherited default configurations, such as a default or a cluster-level property.

Although xref:reference:rpk/rpk-topic/rpk-topic-describe.adoc[`rpk topic describe`] doesn't report `replication.factor` as a configuration, `replication.factor` can indeed be set by using the xref:reference:rpk/rpk-topic/rpk-topic-alter-config.adoc[`rpk topic alter-config`] command.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rpk topic describe does output a summary like

SUMMARY
=======
NAME        {topic}
PARTITIONS  1
REPLICAS    3

which indicates the replication.factor.

You may also want to add a link/disclaimer that more involved information about a topic, its partitions & replicas can be viewed with rpk topic describe {topic} -p.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved with 2e529e9

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, although this output:

SUMMARY
=======
NAME        my-topic
PARTITIONS  1
REPLICAS    1

and

PARTITION  LEADER  EPOCH  REPLICAS  LOG-START-OFFSET  HIGH-WATERMARK
0          0       1      [0]       0                 0

Is a little bit boring (it reflects an unproduced to, single replica, single partition topic).

How about some fudged, more fun output like:

SUMMARY
=======
NAME        my-topic
PARTITIONS  3
REPLICAS    3
PARTITION  LEADER  EPOCH  REPLICAS  LOG-START-OFFSET  HIGH-WATERMARK
0          1       2     [1 2 3]   0                 6
1          2       4     [1 2 3]   0                 10
2          3       1     [1 2 3]   0                 8

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice. I like this. I just generated a new topic and didn't change much. Yours looks much nicer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented here dcf762c


== Examples

The following examples show how to configure topic-level properties. Set a topic-level property for a topic to override the value of corresponding cluster property.

=== Create topic with topic properties

To set topic properties when creating a topic, use the xref:reference:rpk/rpk-topic/rpk-topic-create.adoc[rpk topic create] command with the `-c` option.

For example, to create a topic with the `cleanup.policy` property set to `compact`:

[tabs]
====
Local::
+
--

```bash
rpk topic create -c cleanup.policy=compact <topic-name>
```

--
Kubernetes::
+
--

```bash
kubectl exec <pod-name> -- rpk topic create -c cleanup.policy=compact <topic-name>

--
====

To configure multiple properties for a topic, use the `-c` option for each property.

For example, to create a topic with all necessary properties for Tiered Storage:

[tabs]
====
Local::
+
--

```bash
rpk topic create -c redpanda.remote.recovery=true -c redpanda.remote.write=true -c redpanda.remote.read=true <topic-name>
```

--
Kubernetes::
+
--

```bash
kubectl exec <pod-name> -- rpk topic create -c redpanda.remote.recovery=true -c redpanda.remote.write=true -c redpanda.remote.read=true <topic-name>
```

--
====

=== Modify topic properties

To modify topic properties of an existing topic, use the xref:reference:rpk/rpk-topic/rpk-topic-alter-config.adoc[rpk topic alter-config] command.

For example, to modify a topic's `retention.ms` property:

[tabs]
====
Local::
+
--

```bash
rpk topic alter-config <topic-name> --set retention.ms=<retention-time>
```

--
Kubernetes::
+
--

```bash
kubectl exec <pod-name> -- rpk topic alter-config <topic-name> --set retention.ms=<retention-time>
```

--
====

=== Configure topic properties with Kubernetes

In Kubernetes deployments, configure topic properties using the `additionalConfig` field in Topic resources:

```yaml
apiVersion: cluster.redpanda.com/v1alpha2
kind: Topic
metadata:
name: example-topic
spec:
partitions: 3
replicationFactor: 3
additionalConfig:
cleanup.policy: "compact"
retention.ms: "604800000"
segment.ms: "86400000"
```

Apply the configuration:

```bash
kubectl apply -f topic-config.yaml
```

== Common topic property categories

Topic properties are organized into several categories based on their functionality:

=== Disk space management

Configure properties to manage disk space usage for a topic:

- Clean up log segments by deletion and/or compaction (xref:reference:properties/topic-properties.adoc#cleanuppolicy[`cleanup.policy`]).
- Control compaction timing with maximum and minimum lag settings (xref:reference:properties/topic-properties.adoc#maxcompactionlagms[`max.compaction.lag.ms`] and xref:reference:properties/topic-properties.adoc#mincompactionlagms[`min.compaction.lag.ms`]).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may want to also mention min.cleanable.dirty.ratio here, since those are the 3 major tweakables for compaction at the topic level.

Copy link
Collaborator Author

@paulohtb6 paulohtb6 Aug 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll rework that list to include both space management and compaction. What about:

=== Disk space management

Redpanda manages disk space through two main mechanisms: **compaction** (removing duplicate keys) and **retention** (removing old data). Configure the core compaction properties to control how Redpanda cleans up data:
    
 - Choose cleanup strategy: deletion, compaction, or both `cleanup.policy`
 - Control when compaction triggers based on dirty data ratio `min.cleanable.dirty.ratio`
 - Set maximum time before compaction is forced `max.compaction.lag.ms`
 - Set minimum time before compaction can occur `min.compaction.lag.ms`
    

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The section still feels a little asymmetrical with the description of compaction related properties but no description of retention related properties. Maybe something like

=== Disk space management

Redpanda manages disk space through two main mechanisms: **compaction** (removing duplicate keys) and **retention** (removing old data). Configure the core compaction properties to control how Redpanda cleans up data:
    
 - Choose cleanup strategy: deletion, compaction, or both `cleanup.policy`
 
=== Compaction

 - Control when compaction triggers based on dirty data ratio `min.cleanable.dirty.ratio`
 - Set maximum time before compaction is forced `max.compaction.lag.ms`
 - Set minimum time before compaction can occur `min.compaction.lag.ms`

=== Retention

- retention.bytes
- retention.ms
- etc

would feel more organized, up to you though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice. I like this suggestion. I honestly think that this section still has too many props. But I can't put my finger on it to decide which ones are the the most important.

If you feel that we should nuke other sections, let me know.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reworked that section
399196d

- Retain logs up to a maximum size per partition before cleanup (xref:reference:properties/topic-properties.adoc#retentionbytes[`retention.bytes`]).
- Retain logs for a maximum duration before cleanup (xref:reference:properties/topic-properties.adoc#retentionms[`retention.ms`]).
- Periodically close an active log segment (xref:reference:properties/topic-properties.adoc#segmentms[`segment.ms`]).
- Limit the maximum size of an active log segment (xref:reference:properties/topic-properties.adoc#segmentbytes[`segment.bytes`]).

=== Write performance and caching

Control how Redpanda writes and syncs data to disk:

- Cache batches until the segment appender chunk is full, instead of fsyncing for every `acks=all` write (xref:reference:properties/topic-properties.adoc#writecaching[`write.caching`]).
- Configure the maximum delay between two subsequent fsyncs (xref:reference:properties/topic-properties.adoc#flushms[`flush.ms`]).
- Set the maximum bytes not fsynced per partition (xref:reference:properties/topic-properties.adoc#flushbytes[`flush.bytes`]).

=== Message properties

Configure message-specific settings:

- Set the source of a message's timestamp (xref:reference:properties/topic-properties.adoc#messagetimestamptype[`message.timestamp.type`]).
- Set the maximum size of a message (xref:reference:properties/topic-properties.adoc#maxmessagebytes[`max.message.bytes`]).
- Configure compression for stored data (xref:reference:properties/topic-properties.adoc#compressiontype[`compression.type`]).

=== Tiered Storage

For topics using Tiered Storage, configure:

- Upload and fetch data to and from object storage (xref:reference:properties/topic-properties.adoc#redpandaremotewrite[`redpanda.remote.write`] and xref:reference:properties/topic-properties.adoc#redpandaremoteread[`redpanda.remote.read`]).
- Recover data from object storage (xref:reference:properties/topic-properties.adoc#redpandaremoterecovery[`redpanda.remote.recovery`]).
- Configure local storage retention limits (xref:reference:properties/topic-properties.adoc#retentionlocaltargetbytes[`retention.local.target.bytes`] and xref:reference:properties/topic-properties.adoc#retentionlocaltargetms[`retention.local.target.ms`]).

=== Compaction settings
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of awkward to have this here when min.compaction.lag.ms and max.compaction.lag.ms were discussed above

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed compaction settings section and grouped into disk management.


For topics with compacted cleanup policies, configure:

- Minimum ratio of dirty segments required before compaction (xref:reference:properties/topic-properties.adoc#mincleanabledirtyratio[`min.cleanable.dirty.ratio`]).
- Retention time for tombstone records (xref:reference:properties/topic-properties.adoc#deleteretentionms[`delete.retention.ms`]).

=== Replication and leadership

Configure replication and leadership settings:

- Number of replicas for the topic (xref:reference:properties/topic-properties.adoc#replicationfactor[`replication.factor`]).
- Preferred location for partition leaders (xref:reference:properties/topic-properties.adoc#redpandaleaderspreference[`redpanda.leaders.preference`]).

For complete details about all available topic properties, see xref:reference:properties/topic-properties.adoc[Topic Configuration Properties].

== Related topics

* xref:reference:properties/topic-properties.adoc[Topic Configuration Properties] - Complete reference of all available topic properties
* xref:manage:cluster-maintenance/cluster-property-configuration.adoc[Configure Cluster Properties] - Configure cluster-wide defaults
* xref:develop:config-topics.adoc[Manage Topics] - Create and manage topics
* xref:manage:kubernetes/k-manage-topics.adoc[Manage Topics in Kubernetes] - Topic management in Kubernetes deployments
* xref:console:ui/edit-topic-configuration.adoc[Edit Topic Configuration in Redpanda Console] - Graphical topic configuration
Loading