Browse documentation

Clone Kafka Topics Between Clusters

Data Clone copies selected Kafka topics and message ranges directly between connected clusters. You do not need to export records to files and import them again.

Use it to move only the Kafka data needed for debugging or testing. It is a one-time, bounded copy—not a way to replicate an entire cluster continuously.

Kafma cloning a production topic to a local cluster with field masking

When to use Data Clone

Reproduce a production issue locally

Choose the affected topics and copy the message range around an incident to a local cluster. You can reproduce and investigate the problem without writing to production or moving data through an intermediate file.

Use a time window or offset range to keep the copy focused. If the records contain sensitive fields, add masking rules before they reach the target.

Build local test data from a remote cluster

Copy one or more topics from production or a shared test cluster instead of recreating the whole Kafka environment. Kafma can create the missing topic structure, register the schemas required by the selected data, and append the messages.

Choose Structure only when you need the topic and schema but want to produce your own test records.

Copy data between local Kafka clusters

Move test fixtures between local clusters, or create a renamed copy in the same cluster. Same-cluster clones require a prefix or suffix so the target cannot overlap the source topic.

What Kafma can clone

The selected scope controls what is copied:

  • Topic structure uses the selected partition count and copies the source topic's custom settings, such as retention and cleanup policy, when Kafma creates a missing target topic.
  • Schemas are discovered and registered when the scope includes structure. With Structure + Data, Kafma registers the schema versions used by the selected messages. If the source and target use different Schema Registries, each copied message is updated to use the corresponding schema ID on the target.
  • Messages include their keys, values, timestamps, headers, and tombstones. The selected range applies to each source topic.

Existing target topics are not reconfigured. Kafma either creates a missing topic or appends to the topic already there.

Read-only source and append-only target

Data Clone reads the source without joining a consumer group or committing offsets. It does not modify source topics, messages, or schemas.

On the target, Kafma can create missing topics and register schemas. Copied records are only appended; Kafma never deletes or overwrites existing target records. Writing to a connection marked as production requires confirmation.

What a clone does not preserve

When the scope includes data, Kafma creates new records on the target:

  • Source offsets are not preserved; the target assigns new offsets.
  • Kafma does not preserve source partition numbers. The target producer repartitions keyed records by key and assigns unkeyed records automatically. A record can therefore land on a different partition even when the source and target have the same partition count.
  • If the target has fewer brokers than the source topic's replication factor, Kafma reduces the replication factor to the target broker count.
  • Consumer group offsets and assignments are not copied.
  • Running the same clone again does not deduplicate records. It appends another copy to the target.

Data Clone reads a snapshot bounded by the selected range. Messages produced after the snapshot boundary are not followed, so the result does not stay in sync with the source.

Data Clone workflow

  1. Select the source cluster and topics.
  2. Choose whether to copy structure, data, or both.
  3. Limit the message range and add any masking rules.
  4. Select the target, naming rule, and partition strategy.
  5. Run pre-flight and review every planned action.
  6. Start the clone and inspect the result on the target.

Next steps