Skip to main content

Remove topic prefix when replicating with Apache Kafka® MirrorMaker 2

When using Apache Kafka® MirrorMaker 2 to replicate topics across Apache Kafka® clusters, the default target topic name is in the form <SOURCE_CLUSTER_ALIAS>.<TOPIC_NAME>. For example, if the source Apache Kafka clusters alias is src-kafka, replicating the source topic named orders via Apache Kafka MirrorMaker 2 creates a target topic named src-kafka.orders.

For most use cases, the extra prefix is not an issue. However, you might be using a backup Apache Kafka cluster for Disaster Recovery. In this scenario, you want your consumers and producers to be able to switch with minimal downtime and without needing to modify the topic names in their configuration.

In the Aiven console, modify the flow details in the service page Replication Flow tab:

Remove the topic prefix, you have to change the replication flow replication_policy_class parameter from the default org.apache.kafka.connect.mirror.DefaultReplicationPolicy value, which includes the source cluster alias in the target topic name to org.apache.kafka.connect.mirror.IdentityReplicationPolicy.