Replicated topics configs
Control target cluster topic creation and their configuration.
To execute K2K, you must agree to the EULA and secure a free license.
Accept the EULA by setting license.acceptEula to true .
K2K streamlines data transfer between environments by automatically creating target cluster topics when they do not exist. This automation enhances workflow efficiency and reduces manual setup. However, this feature is only active when the auto-create topics flag is enabled. Without it, users must manually ensure the necessary topics are available in the target cluster, which can be tedious and error-prone, especially with configuration differences like variations in partition count or replication factors.
This tutorial assumes the following files exist (See Setting up for more details):
To ensure a clean start, execute this command to reset any prior configurations from earlier tutorials.
Defining the replication rules
Rules are defined under topicCreation.replication. The final topic configuration merges three sources in order of precedence:
Matching rules from
topicCreation.replication.rules(highest priority)Common settings from
topicCreation.replication.commonSource topic configuration (lowest priority)
Below are examples illustrating the topic creation process:
Topic: user-topic
Created with 20 partitions.
Applies
topicCreation.replication.rules[0]that matches the topic name.This rule takes precedence over both
topicCreation.replication.common.partitionsand the original topic's partition count.
Topic: transfers-us
Created without specifying a partition count.
Defaults to the Kafka instance's standard partition count.
Occurs because
topicCreation.replication.common.partitionsis set tonull, overtaking the source topic's partition count.
topicCreation:
replication:
common:
partitions: null
replication: 1
config:
"delete.retention.ms": "1000"
rules:
- pattern: ".*-topic"
properties:
partitions: 20
replication: 1
config:
"delete.retention.ms": "1000"
- pattern: "transfers.*"
config:
"delete.retention.ms": "2000"
- pattern: ".*"
partition: 7Last updated
Was this helpful?

