What Is Cluster Linking in Kafka?
A beginner-friendly guide to connecting two Kafka clusters so that topics are copied exactly, offsets stay the same and applications can move between clusters: how it works, when to use it, how it differs from MirrorMaker, and how to run it safely.
Imagine a company with a head office in one city and a big branch office in another. Both offices keep the same important record book. At first, an assistant travels between them every night, copies the pages by hand into a new book, and the page numbers in the copy never quite match the original. When something goes wrong, nobody is sure which page of the copy corresponds to which page of the original. Now imagine a special photocopier that connects the two offices directly. Every page appears in the second book exactly as it is in the first, with the same page number, moments after it is written. Cluster Linking is that special photocopier for Kafka. This guide explains what it is, how it works and when to use it, from zero, without assuming that you have used multiple Kafka clusters before.
1Why One Kafka Cluster Is Often Not Enough
A single cluster can be very large and very reliable. Yet many organisations end up running several clusters, and then the trouble begins.
Kafka in one paragraph
Apache Kafka stores streams of messages, called records, in named channels called topics. Each topic is split into partitions, and every record in a partition gets a position number called an offset. Applications that write records are producers, and applications that read them are consumers. A group of Kafka servers working together is called a cluster.
Reasons for having more than one cluster
Different places
A company has data centres in several countries, plus one or more public cloud regions. Applications should talk to a cluster that is close to them, because distance means delay.
Disaster protection
A cluster in one location is at risk if that entire location loses power, network or is affected by a natural disaster. A second cluster in another region can take over.
Moving between environments
A company moves from its own servers to the cloud, or from one cloud provider to another. For a while, old and new clusters must both exist.
Separate teams and rules
Different business units, or different companies, may run their own clusters for cost, ownership or legal reasons, and still need to share some data.
flowchart LR
subgraph OnPrem[Own data centre]
C1[(Cluster A)]
end
subgraph CloudR1[Cloud region 1]
C2[(Cluster B)]
end
subgraph CloudR2[Cloud region 2]
C3[(Cluster C)]
end
C1 |Data must flow| C2
C2 |Data must flow| C3
The core problem
Once you have two clusters, the same question keeps appearing: how do we get the data from one to the other, reliably, without losing track of where each application is in its reading? Answering that question well is the whole reason Cluster Linking exists.
Think of two libraries that should hold the same books. The hard part is not carrying the books across town once. The hard part is keeping both shelves in sync every day, and making sure a reader’s bookmark still works after switching libraries.
2The Old Way: Copying With a Separate Tool
Before Cluster Linking, the usual solution was a separate program that reads from one cluster and writes to the other.
How the older approach works
Tools such as MirrorMaker, and its improved second version, work like a pair of applications glued together. One part acts as a consumer and reads records from the source cluster. The other part acts as a producer and writes those records into the destination cluster. In many setups this runs inside a separate service, such as Kafka Connect, which itself needs to be installed, scaled, secured and monitored.
flowchart LR
S[(Source cluster)] -->|Consumer reads| M[Separate copy tool]
M -->|Producer writes| D[(Destination cluster)]
The problems this creates
Extra machines to run
The copy tool is another system with its own servers, configuration, upgrades and failures to look after.
Offsets do not match
Because records are rewritten, they usually land at different positions in the destination. Position 500 in the source may be position 470 in the copy.
Moving consumers is hard
When a consumer switches clusters, its saved position must be translated. Getting it wrong means reading records twice or skipping some.
Extra work per record
Every record is read, unpacked, repacked and written again, using processor time and adding delay.
The older approach is the assistant who retypes every page of the record book into a new book. It works, but it takes staff, it is slower, and the page numbers of the copy never line up with the original.
Tools like MirrorMaker are still widely used and are perfectly valid choices. They are part of open-source Apache Kafka. Cluster Linking is a different design that trades some flexibility for simplicity and exact copies, as we will see.
3So, What Is Cluster Linking?
Cluster Linking connects two Kafka clusters directly and keeps chosen topics identical between them, without any separate copying program.
Cluster Linking is a feature that lets one Kafka cluster pull topics from another cluster and keep exact copies of them, including the position numbers of every record. The copying is done inside the Kafka brokers themselves, using the same mechanism that brokers already use to copy data between each other for safety. There is no consumer-and-producer pair in the middle, and no separate service to run.
Cluster Linking is a feature of Confluent Platform and Confluent Cloud. It is not a built-in feature of plain open-source Apache Kafka. If you run open-source Kafka only, the standard tool for copying between clusters is MirrorMaker. Always confirm which distribution and version you run before planning around this feature.
Cluster Linking is the special photocopier that connects the two offices. Pages written in the head office appear in the branch book with the same page numbers, and nobody has to carry papers or retype anything.
The three big ideas
Broker-to-broker copying
The destination cluster fetches data directly from the source cluster, much as a follower replica fetches from a leader.
Byte-for-byte fidelity
Records are copied exactly, in the same partitions and at the same offsets, so the copy is a true mirror.
Mirror topics
The copied topics in the destination are special read-only topics that can later be turned into normal topics when you are ready to switch over.
4The Vocabulary of Cluster Linking
A few words appear again and again. Once these are clear, everything else falls into place.
Source cluster
The cluster where the original topics live and where producers write.
Destination cluster
The cluster that holds the mirrored copies. It usually fetches data from the source.
Cluster link
The named connection configuration between the two clusters. It is created on the destination and describes how to reach and copy from the source.
Mirror topic
A topic in the destination that is an exact, read-only copy of a topic in the source, kept up to date through the link.
Mirroring lag
How far a mirror topic is behind its source topic, measured in records.
Promote and failover
The two ways of turning a read-only mirror topic into a normal writable topic, described in a later chapter.
The source is the original record book. The destination is the branch office. The link is the direct wire between them. A mirror topic is one chapter of the branch copy, locked for reading until the head office says the branch may start writing its own entries.
Why mirror topics are read-only
If both clusters allowed writes to the same topic, they would quickly disagree about which record sits at which position, and the exact match would be lost. To keep copies perfect, a mirror topic accepts data only from the link. Applications may read from it as much as they like, but they cannot write to it until it has been detached from its source through promotion or failover.
Read-only does not mean useless. Consumers in the destination can process mirrored data right away, which is a big benefit for analytics, local reads and testing a migration.
5How Cluster Linking Works Inside
The trick is that the destination cluster behaves like a very well-behaved follower of the source cluster.
A quick reminder about replication inside a cluster
Inside one Kafka cluster, each partition has a leader broker and follower brokers. Followers fetch data from the leader and store an exact copy at the same offsets. That is how Kafka survives a broker failure. Cluster Linking extends that same idea across cluster boundaries: the destination’s brokers act like remote followers that fetch from the source’s leaders.
flowchart LR
subgraph SRC[Source cluster]
SL[Leader of partition 0]
end
subgraph DST[Destination cluster]
ML[Mirror partition 0]
end
ML -->|Fetch bytes over the link| SL
SL -->|Records with original offsets| ML
You create a link on the destination
You give it the address of the source and the credentials needed to connect, plus a few settings.
You create a mirror topic
You choose a source topic to copy, and the destination creates a matching read-only topic with the same number of partitions and similar settings.
The destination fetches from the source
Each mirror partition fetches from the corresponding source partition, starting at the beginning or from a chosen point.
Records are stored unchanged
The batches of bytes are written in the destination as they are, in the same partition, with the same offsets and timestamps.
The link keeps going
New records in the source keep flowing to the mirror. Consumers in the destination can read them soon after they appear.
Why this is more efficient
Since the data is copied as raw batches of bytes, the destination does not need to unpack each record, rebuild it and write it again. It also does not need a consumer group, a producer or a separate service. This is why the approach is lighter than a traditional copy tool, and why offsets, timestamps and even the arrangement into partitions can be kept exactly the same.
The link is normally started from the destination side, which reaches out to the source. This affects how you plan network access. Some setups also support starting the link from the source side, for cases where a firewall only allows outgoing connections from the source.
6Why Preserved Offsets Are a Big Deal
Keeping the same position numbers sounds like a small detail. In practice, it removes the hardest part of moving between clusters.
What consumers remember
A consumer saves its progress as an offset for each partition, meaning “I have read up to here.” When it restarts, it continues from that saved place. The saved offset only makes sense inside the cluster where it was recorded. If the same data lives at different offsets in another cluster, the saved number points to the wrong place.
| Situation | Traditional copy tool | Cluster Linking |
|---|---|---|
| Offset of a record in the copy | Often different from the source | Identical to the source |
| Moving a consumer to the copy | Needs offset translation, which can be approximate | The same offset works directly |
| Risk when switching | Repeated or skipped records | Much smaller, limited by how far the copy lagged |
| Extra tooling for offsets | Checkpoint and translation logic | Optional syncing of consumer group offsets through the link |
A bookmark in a book only helps if the second book has the same page numbers. With identical copies, your bookmark at page 500 still means page 500 in the other book, and you can carry on reading without hunting for your place.
Consumer offset syncing
The link can also copy the saved positions of consumer groups from the source cluster to the destination. You can choose which groups to include with filters. When you later switch a consumer application to the destination, it can continue from roughly where it stopped, limited only by the sync interval and by the lag of the mirror.
Expecting a perfectly exact resume position with no duplicates. Copying is asynchronous, and offsets are synced at intervals, so a consumer that moves may re-read a small number of records. Applications should be built to handle occasional repeats.
7The Life of a Mirror Topic
A mirror topic passes through a small number of stages, from creation to becoming a normal topic.
flowchart LR
A[Created as mirror topic] --> B[Active: read-only and catching up]
B --> C{Decision}
C -->|Source is healthy, planned switch| D[Promote: wait until fully caught up]
C -->|Source is down or lost| E[Failover: stop immediately]
D --> F[Normal writable topic]
E --> F
B --> G[Paused: temporarily stopped]
G --> B
Active
The mirror is receiving data and can be read by consumers. Writes from applications are refused.
Paused
You have temporarily stopped the copying. The data already copied stays, and copying can resume later.
Promoted
The mirror has been fully caught up with the source and then converted into a normal topic. No data is lost.
Failed over
The mirror was converted right away, without waiting for the source. Data that had not yet been copied is missing.
Promote versus failover
| Aspect | Promote | Failover |
|---|---|---|
| When used | Planned moves, such as migrations, with a healthy source | Emergencies when the source is unavailable |
| Needs the source running | Yes, to finish catching up | No |
| Data loss | None expected, since it waits for zero lag | Possible loss of records not yet copied |
| Speed | Waits for catch-up | Immediate |
| After the change | Topic is writable and detached from the source | Topic is writable and detached from the source |
Promote is a planned handover at a shift change: the outgoing worker finishes the last task and hands over a clean desk. Failover is when the outgoing worker suddenly disappears and the new one must start with whatever is on the desk.
Once a mirror topic is promoted or failed over, it is no longer linked. If you need it to mirror again from another source, plan a new arrangement, because the topic now has its own independent history.
8What Gets Copied and What Does Not
A link can carry more than raw records. Knowing exactly what travels avoids surprises.
| Item | Copied? | Notes |
|---|---|---|
| Records and their order | Yes | Same partitions, same offsets, same timestamps |
| Partition count | Yes | The mirror matches the source, and new partitions can be picked up |
| Topic settings | Yes, in general | Many topic-level settings are kept in sync, with some restrictions |
| Consumer group offsets | Optionally | Controlled with filters and a sync interval |
| Access rules (ACLs) | Optionally | Can be synced with filters, but should be reviewed |
| Schemas | Not by the link itself | Schema registries need their own arrangement for sharing schemas |
| Connectors and applications | No | You must deploy those on the destination separately |
| Changes to records in flight | No | No filtering or transformation, since bytes are copied unchanged |
Schemas deserve special attention
Records that use a schema registry contain a small number that refers to a schema stored in that registry. If the destination applications use a different registry, or a registry without the same schemas and the same numbers, they may not be able to read the records. Teams therefore plan how schemas travel with the data, for example by sharing one registry or by using registry features that keep schemas in step.
Linking topics and forgetting about schemas. The records arrive, but consumers fail because they cannot find the schema for the numbers embedded in the data. Plan schemas and data together.
No changes on the way
Because Cluster Linking copies bytes exactly, you cannot filter records, rename fields, change the number of partitions of a mirror or transform the data as it passes. If you need such changes, you add a separate processing step afterward, for example a stream processing application on the destination that reads the mirror and writes a new topic.
9Configuring a Link: The Main Ideas
You do not need to remember every setting. It is enough to understand the groups of choices you make.
How to reach the source
The address of the source cluster, and the login and encryption settings needed to connect to it.
Which topics to mirror
Either named topics one by one, or filters that automatically create mirror topics for matching names.
Consumer offset syncing
Whether to copy consumer group positions, which groups, and how often.
Access rule syncing
Whether to copy access rules, and which ones, with filters.
Naming
Whether mirror topics keep the same name as the source, or receive a prefix that shows their origin.
Connection behaviour
Timeouts, retry behaviour and limits that control how the link acts under trouble.
Automatic mirroring with filters
Instead of creating mirror topics one at a time, you can tell the link to create them automatically for every source topic whose name matches a pattern. New topics that appear later in the source, and that match the pattern, are mirrored without any manual step. This is convenient for large environments, but it needs careful patterns, because a pattern that is too broad may copy topics you never meant to move, along with their cost.
Prefixes for clarity
A prefix on mirror topic names, such as the name of the source region, makes it obvious where a topic came from and helps avoid clashes when the destination already has topics with the same names or when several sources are linked in. The trade-off is that applications must use the prefixed name, which may need changes at switch-over time.
Same names
Applications can switch clusters with no change to topic names. Best for migrations and disaster recovery, where the goal is to look identical.
Prefixed names
Clear origin and no clashes. Best when combining several sources, or when the destination has its own topics with the same names.
Keep link settings in version control as configuration files, and review them like code. A link is important infrastructure, and a hidden manual change is hard to trace.
10Security and Networking
A link carries all your data between clusters, so it must be protected like any other important connection.
Encrypt and authenticate the link
The destination connects to the source just like any client, so it needs a way to prove its identity and a way to protect the connection from eavesdropping. Use encrypted connections, and give the link its own dedicated identity, with a password or key or a certificate, instead of reusing a person’s account. That identity should be able to do only what the link needs: read the chosen topics, and, if syncing is turned on, read group information and access rules.
Give the link its own identity
A dedicated account makes it easy to see in logs what the link did, to rotate its secret without touching people, and to withdraw its access at once if needed.
Grant least privilege on the source
Allow read access only for the topics that should be mirrored, and other permissions only if features such as offset syncing truly need them.
Protect the secrets
The link stores credentials to reach the source. Keep them out of shared documents and repositories, and rotate them on a schedule.
Network paths
The destination brokers must be able to reach the source brokers over the network, on the ports used for Kafka. Across data centres or clouds, this may mean private connections, peering between networks, or careful firewall rules. If the source sits behind a strict firewall that only allows outgoing connections, a link that is started from the source side may be the answer. Private networking options reduce exposure to the public internet and are preferred for sensitive data.
Think of the link as an armoured courier between two offices. The courier needs a badge (identity), a sealed bag (encryption) and a permitted route (network access). Missing any of these and the delivery stops.
Using an administrator account for the link “to make it work.” If that secret leaks, an attacker gains far more than read access to a few topics. Always use a narrow identity for a link.
Data protection and regulations
Mirroring copies data into another region or another country. That may be forbidden or restricted by privacy laws or company policy. Before linking clusters across borders, check which data may leave its home region, and choose topics accordingly. Remember that everything in a mirrored topic is copied, including any sensitive fields inside the records.
11Use Case: Hybrid and Multi-Cloud Data Sharing
Many companies live in two worlds at once: their own data centres and one or more public clouds. Cluster Linking is a bridge between them.
Feeding cloud analytics from on-premises systems
Core business systems generate events in a private data centre. A link mirrors the chosen topics into a cloud cluster, where cloud analytics and machine learning services consume them, without touching the on-premises applications.
Sharing data between clouds
Two teams use different cloud providers. A link mirrors topics from one provider’s cluster to the other, so each team works close to its own tools while sharing the same events.
Sharing data between organisations
A company offers a stream of data to a partner. The partner links a cluster of their own to the shared topics and reads locally, with no need to open their applications to the company’s internal network.
flowchart LR
subgraph ONP[On-premises cluster]
T1[Orders topic]
end
subgraph CLD[Cloud cluster]
M1[Mirror of orders topic]
end
T1 -->|Cluster link| M1
M1 --> A1[Cloud analytics]
M1 --> A2[Machine learning services]
Why this is better than many direct connections
Without linking, every cloud application that needs on-premises data would connect back to the on-premises cluster across the network. That multiplies traffic, complicates security and makes every application depend on the distant cluster. With a link, the data crosses the distance once, and all local applications read from the nearby copy.
It is like shipping a pallet of goods once to a regional warehouse, and letting local shops collect from there, instead of every shop sending its own truck to the faraway factory.
12Use Case: Migrating From One Cluster to Another
Moving a busy Kafka system is one of the scariest jobs in operations. Linking turns it into a calm, staged process.
Why migrations are hard
Dozens or hundreds of applications write to and read from the old cluster. Each has saved positions. You cannot stop the business for a weekend, and you cannot move everything at the same second. You need a way for both clusters to hold the same data during the move, and a way for applications to switch one at a time.
flowchart TD
A[Create link from old cluster to new cluster] --> B[Mirror topics and sync consumer offsets]
B --> C[Wait until mirroring lag is near zero]
C --> D[Move consumers to the new cluster, group by group]
D --> E[Stop producers on the old cluster]
E --> F[Promote mirror topics once fully caught up]
F --> G[Point producers at the new cluster]
G --> H[Decommission the old cluster]
Prepare the new cluster
Set up security, networking and capacity in the destination, and test connectivity to the old cluster.
Create the link and mirror topics
Start with less critical topics as a rehearsal, and check that data and offsets match.
Move consumers first
Consumers can read from the mirror while producers still write to the old cluster. Move them group by group, starting with low-risk ones.
Switch producers at a planned moment
Stop producers on the old cluster, wait for the mirror to catch up completely, and promote the mirror topics to normal topics.
Start producers on the new cluster
Producers now write to the new cluster, which continues the same history without a gap.
Watch, then retire the old cluster
After a comfortable period of stable operation, remove the link and shut down the old cluster.
Migrating with a link is like moving to a new house while keeping the old one running. You first move the readers of your mail, then, on a quiet evening, you change the address for outgoing mail and hand over the keys of the old house.
Rehearse the whole process with a small set of test topics before the real move, including the rollback plan. A migration that has been practised once is much calmer than one done for the first time in production.
13Use Case: Disaster Recovery
A second cluster in another region is an insurance policy. Cluster Linking keeps that policy up to date.
The active and standby pattern
In the most common disaster recovery design, one cluster does all the work, and a second cluster in another region quietly mirrors its important topics through a link. If the main region fails, applications are switched to the standby cluster. Because offsets are preserved and consumer positions can be synced, applications can carry on from nearly where they stopped.
sequenceDiagram
participant App as Applications
participant Pri as Primary cluster
participant Sec as Standby cluster
App->>Pri: Normal operation, writes and reads
Pri-->>Sec: Link keeps mirror topics up to date
Note over Pri: Region fails
App->>Sec: Operations team fails over mirror topics
Sec-->>App: Topics writable, consumers resume from synced offsets
Two numbers every recovery plan needs
Recovery Point Objective (RPO)
How much data you can afford to lose, expressed as time. Since the link copies data asynchronously, the last few moments before a disaster may be missing. Mirroring lag tells you the real number.
Recovery Time Objective (RTO)
How long you can be down. It depends on how quickly you detect the failure, fail over the topics and redirect applications. Automation and practice shrink it.
RPO is how many pages of the record book you may lose if the head office burns down, because the last few pages had not yet been copied. RTO is how many hours it takes the branch to open for business using its copy.
A typical failover checklist
Confirm the primary is truly unavailable
Avoid failing over because of a short network glitch. Agree in advance on who decides and on what evidence.
Check mirroring lag before the outage, if possible
This shows how much data might be missing and helps in later reconciliation.
Fail over the mirror topics
Convert the read-only mirrors into normal writable topics on the standby cluster.
Redirect applications
Change the connection addresses, using a configuration switch or a name that can be repointed, and restart or refresh applications.
Verify and monitor
Check that producers write, consumers read and business results look correct.
Failing back afterwards
When the original region returns, its data is behind the standby, which has accepted new writes. Returning to it needs a plan: typically you rebuild the old primary as a mirror of the new one, wait until it catches up, and then perform a planned switch back. Some environments support reversing the direction of a link to make this easier. Whatever the method, practise it, because failing back badly can cause data loss just as failing over badly can.
Building a disaster recovery link and never testing a failover. An untested plan is a hope. Schedule regular drills, measure how long they take and fix what goes wrong while nothing is at stake.
14Use Case: Reading Close to Home and Sharing Data Widely
A mirror is not only a backup. It is also a local copy that applications can read cheaply and quickly.
Lower delay for readers
An application in another continent would suffer if it read from a distant cluster for every request. Reading from a nearby mirror gives it fast local access, and the data crosses the long distance only once.
Protecting the main cluster from heavy readers
Analytics jobs that read enormous amounts of data can slow down the cluster that serves live business applications. Pointing them at a mirror keeps the main cluster calm.
Building a company-wide data network
Several teams each own a cluster and publish a few topics for others. Links let each team subscribe to the topics of others by mirroring them, forming a web of shared data with clear ownership.
Testing and staging
A test cluster can mirror production topics, giving developers realistic data flows without touching production systems. Sensitive data must be handled with care in such copies.
A mirror in a regional office is like a local branch of a public library. Readers borrow books nearby, and the central library is not disturbed by every reader in the country.
Treat each mirrored topic as owned by its source team. Consumers of the mirror should know who to ask about the data, and should follow the source team’s rules about schemas and changes.
15Cluster Linking versus MirrorMaker
Both connect clusters. They make different trade-offs, and the right choice depends on your needs and your platform.
| Aspect | Cluster Linking | MirrorMaker 2 |
|---|---|---|
| Availability | Confluent Platform and Confluent Cloud | Part of open-source Apache Kafka |
| How it runs | Inside the destination brokers | As connectors in a Kafka Connect cluster |
| Extra infrastructure | None beyond the clusters | A Connect cluster to install, scale and monitor |
| Copy method | Raw bytes, like a follower fetching | Consume records then produce them again |
| Offsets in the copy | Same as the source | Usually different, with translation through checkpoints |
| Topic names | Same by default, prefix optional | Source cluster name added by default, configurable |
| Consumer position handling | Optional direct offset sync | Checkpoints and translation utilities |
| Changing data in flight | Not possible | Possible with transformations and custom logic |
| Writable copy | Read-only until promoted or failed over | Copy is a normal topic, though two-way setups need care |
| Bidirectional topics | Different topics in each direction, since mirrors are read-only | Supported through naming rules that avoid loops |
| Source systems supported | Confluent clusters, and certain other Kafka versions depending on setup | Any Kafka cluster it can connect to |
Where Cluster Linking shines
- Fewer moving parts to operate
- Exact offsets make consumer moves simple
- Efficient byte-level copying
- Clean migration and disaster recovery stories
Where it is limited
- Tied to specific platforms and versions
- No filtering or transformation on the way
- Mirror topics are read-only until detached
- Less flexible for unusual copying rules
MirrorMaker is a flexible courier company that can repackage goods on the way and works with any warehouse. Cluster Linking is a dedicated pipeline between two compatible warehouses: faster and simpler, but it moves crates exactly as they are.
If you run open-source Kafka, or you need to transform data while copying, MirrorMaker is the natural tool. If you are on a platform that offers Cluster Linking and you value exact copies and simple operations, linking is very attractive. Some organisations use both, for different jobs.
16Topology Patterns: How to Arrange the Links
With more than two clusters, the arrangement of links matters as much as the links themselves.
flowchart TD
subgraph HS[Hub and spoke]
H[(Hub cluster)] --> S1[(Spoke 1)]
H --> S2[(Spoke 2)]
H --> S3[(Spoke 3)]
end
subgraph FI[Fan-in]
A1[(Regional 1)] --> AG[(Aggregate cluster)]
A2[(Regional 2)] --> AG
A3[(Regional 3)] --> AG
end
subgraph AS[Active and standby]
P[(Primary)] --> SB[(Standby)]
end
Active and standby
One primary cluster serves all traffic, and one standby mirrors it for recovery. Simple, and the most common starting point.
Hub and spoke
A central cluster shares topics to many remote clusters, so each region reads locally. Good for distributing reference data or company-wide events.
Fan-in
Many regional clusters send their data to one aggregate cluster for global analytics. Prefixes keep topics from different regions apart.
Active in both places
Each region writes to its own topics, and mirrors the other region’s topics. Since mirrors are read-only, each side owns different topics, and readers combine them.
Avoiding loops and confusion
Because mirror topics are read-only, you cannot accidentally create the endless copy loops that plagued some older two-way setups. But you still must plan naming. In an active-in-both-places design, topics should carry a prefix such as the region name, so that readers know which cluster wrote the data and never mix two histories in one topic.
Expecting two clusters to share one writable topic with both sides writing at once. A mirror topic is a copy of one source. If both regions must write, use separate topics per region and combine them when reading.
Chains of links
A destination can itself be the source for another link, forming a chain from one cluster to a second and then to a third. Each hop adds delay, and the total lag is the sum of the delays. Keep chains short, and watch lag at every step.
17Performance, Cost and Delay
Copying data across distance costs time and money. Understanding both keeps surprises away.
Throughput
The speed of a link depends on the network between the clusters, the load on the source brokers and the number of partitions being mirrored. Since each partition is copied independently, more partitions give more parallelism. A slow or congested long-distance connection is the most common limit, so measure real bandwidth between the regions before deciding how much to mirror.
Delay and lag
Copying is asynchronous. A record written to the source appears in the mirror after a delay, usually short, but growing with distance, load and network trouble. This delay is the mirroring lag. It matters most for disaster recovery, because it decides how much recent data might be missing at failover, and for applications that read the mirror, because they see events slightly later than readers of the source.
Lag is like the time between a page being written in the head office book and the same page appearing in the branch book. On a good day it is seconds. During a storm on the road between the offices, it grows.
Cost
Network transfer
Moving data between regions or between clouds often has a per-gigabyte charge. Mirroring large, busy topics can become a major part of the bill.
Storage in the destination
Every mirrored topic takes up disk space in the destination, for as long as its retention says.
Extra load on the source
The link reads like an additional consumer, so the source brokers must have enough capacity for that read traffic.
Operational attention
Someone must watch links, handle drills and keep settings up to date. This is smaller than for separate copy tools, but not zero.
Mirror only the topics you truly need in the other cluster. Choosing carefully is the biggest single lever on both cost and complexity. Compression on the topics also reduces the data moved across the link.
18Monitoring a Cluster Link
A link that silently stops is worse than no link, because everyone believes the copy is safe. Watch it closely.
Link status
Whether the link is active and connected, or has lost contact with the source. Alert whenever it is not healthy.
Mirror topic status
Each mirror topic reports its state, such as active, paused or failed. A mirror that is not active is not protecting you.
Mirroring lag
How many records each mirror is behind. Watch the maximum across partitions, and its trend over time.
Bytes and records mirrored
How much data crosses the link per second. Unexpected drops or jumps deserve a look.
Consumer offset sync health
Whether group positions are being copied on schedule, and whether any errors occur.
Source and destination broker load
Processor, network and disk use on both sides, since a link adds work to both.
Turning numbers into alerts
| Signal | Concerning condition | Why it matters |
|---|---|---|
| Link not active | Any sustained period | No data is being copied, so recovery data is going stale |
| Mirror topic failed or stopped | Any occurrence | That topic is no longer protected or up to date |
| Mirroring lag rising | Steady growth, or above your tolerance | Higher potential data loss at failover, and delayed readers |
| Throughput drops to zero | While the source is still producing | The link may be blocked or misconfigured |
| Offset sync errors | Sustained errors | Consumers may resume from stale positions after a switch |
Express lag as time as well as records. “The standby is about ten seconds behind” is much easier to compare with your recovery objective than “the standby is forty thousand records behind.”
19Troubleshooting Common Problems
Most link problems fall into a few familiar groups: reaching the source, permissions, and mismatched expectations.
| Symptom | Likely cause | First thing to check |
|---|---|---|
| Link cannot connect | Network path blocked, wrong address or encryption mismatch | Reachability from the destination brokers to the source, and security settings |
| Link connects but no topics appear | Filters too narrow, or missing permissions on the source | Topic filters, and the link identity’s read access |
| Mirror topic creation fails | Name already exists in the destination, or a version limit | Existing topics and platform compatibility notes |
| Mirroring lag keeps growing | Slow network, overloaded brokers or too much data | Bandwidth, broker load and mirrored volume |
| Consumers resume from the wrong place after switching | Offset sync missed the group, or sync interval too long | Offset sync filters and timing, and whether the group was active |
| Application cannot write to the topic | Topic is still a read-only mirror | Whether promotion or failover was completed |
| Consumers cannot decode records after moving | Schemas not available in the destination registry | Schema registry arrangement and schema identifiers |
flowchart TD
A[Data not appearing in the mirror] --> B{Is the link active?}
B -- No --> B1[Check network path, credentials and encryption]
B -- Yes --> C{Is the topic covered by a mirror or filter?}
C -- No --> C1[Create the mirror topic or fix the filter]
C -- Yes --> D{Is the mirror active, not paused or failed?}
D -- No --> D1[Resume or repair the mirror topic]
D -- Yes --> E{Is lag growing?}
E -- Yes --> E1[Check bandwidth and broker load]
E -- No --> F[Check that the source is actually producing]
Keep a short, written runbook for each link: what it copies, who owns it, how to check its health, how to fail over and how to fail back. In an incident, nobody wants to work these out from scratch.
20Limits and Gotchas to Know Up Front
Every design has edges. Knowing them early prevents unpleasant surprises during a real event.
Platform and version requirements
The feature depends on specific platform versions on the destination, and on compatible versions on the source. Check the compatibility notes for your exact combination before planning a rollout.
Asynchronous copying means possible data loss at failover
Whatever has not yet crossed the link when the source fails is missing in the copy. Only a planned promotion with a healthy source guarantees a full copy.
Read-only mirrors
Applications cannot write to a mirror. Any design that expects writes on both sides to the same topic needs a different layout.
No transformation or filtering of records
The link copies whole topics as they are. Filtering or reshaping data needs another tool after the copy.
Promotion detaches the topic
After promotion or failover, the topic no longer follows the source. Bringing it back into a mirroring relationship needs a deliberate procedure.
Applications, schemas and connectors are not part of the copy
Only topic data, and optionally offsets and access rules, travel. Everything else in your ecosystem needs its own plan for the second cluster.
Special features may have special rules
Topics that use certain advanced features, such as transactions or compaction, may have particular behaviours or restrictions with mirroring. Check the documentation for your version, and test with representative topics.
Assuming that every Kafka feature works identically through a link. Test with your real topics and applications, including the awkward ones, before you rely on the link for something important.
21Best Practices and Anti-Patterns
Habits that keep links healthy and traps that turn them into hidden risks.
Good habits
Decide the purpose first
Know whether the link is for migration, recovery, sharing or local reads, since this shapes topics, naming and monitoring.
Mirror only what you need
Choose topics deliberately and keep filters tight, to control cost and complexity.
Use a dedicated, least-privilege identity
Give the link its own account with only the access it needs, and rotate its secret.
Encrypt and secure the network path
Use encrypted connections and private networking where possible.
Plan schemas, applications and connectors together with the data
A second cluster is useful only if everything around it can run there too.
Monitor status and lag, and alert on both
Make it impossible for a stopped link to go unnoticed.
Rehearse failover and failback
Run regular drills and record how long they take and what you learn.
Write down ownership and runbooks
Every link needs a named owner and clear steps for the common tasks.
Anti-patterns to avoid
Problem
Setting up a link for disaster recovery and treating the project as finished, without alerts, without drills and without a documented failover plan.
Why It’s Harmful
The link may have stopped weeks ago, and nobody knows. On the day of a real disaster, the team discovers that the copy is stale or that nobody knows the steps.
Correct Approach
Monitor the link, alert on status and lag, document the plan, and rehearse failover on a regular schedule.
Problem
Mirroring every topic with a broad pattern because it is simpler than choosing.
Why It’s Harmful
Unneeded topics consume bandwidth, storage and money, may move sensitive data where it should not go and make monitoring noisy.
Correct Approach
Select topics on purpose, review the list regularly and remove mirrors that are no longer needed.
Problem
Ignoring schemas, so that data arrives in the second cluster but cannot be read by applications there.
Why It’s Harmful
Recovery or migration fails at the worst moment, even though every record was copied perfectly.
Correct Approach
Plan how schemas are shared or synchronised, and test reading mirrored data with real applications.
Problem
Using an administrator identity for the link, and sharing its secret widely so that it is easy to set up.
Why It’s Harmful
A leaked secret gives an attacker broad control over the source cluster, far beyond what copying requires.
Correct Approach
Create a narrow identity for the link, store its secret safely and rotate it regularly.
Problem
Failing over on the first sign of trouble, without agreed criteria, and without considering how to return afterwards.
Why It’s Harmful
An unnecessary failover can lose data and create two diverging histories, which are hard to reconcile.
Correct Approach
Agree in advance who decides, on what evidence, and how failback will work, before any real event.
22Real-World Scenarios
Let us see how linking helps in situations that teams often face.
A retailer moving from its own data centre to the cloud
Hundreds of applications use the old cluster. The team links the new cloud cluster to the old one, moves consumers first, then switches producers in a short planned window. Offsets are preserved, so consumers continue without reprocessing large amounts of data.
A bank protecting against the loss of a region
A standby cluster in another region mirrors critical topics. Twice a year, the bank runs a full failover drill, measuring how much data would be lost and how long the recovery takes, and adjusts the plan based on the results.
A global company with regional clusters
Each region has its own cluster for local applications. A fan-in link brings every region’s topics into a central cluster with region prefixes, where analysts work with worldwide data without touching regional systems.
A software provider sharing a live data feed with customers
Each customer links their own cluster to the provider’s shared topics, reading a local mirror. The provider controls which topics are shared through access rules, and customers do not need network access to the provider’s internal systems.
A team testing a big application upgrade
The team mirrors selected production topics into a staging cluster, and runs the new application version against real traffic patterns with no risk to production, taking care to protect or mask sensitive fields.
23Frequently Asked Questions
It is a feature that lets one Kafka cluster fetch topics directly from another and keep exact, read-only copies, called mirror topics, with the same partitions and offsets.
No. It is a feature of Confluent Platform and Confluent Cloud. Open-source Kafka users usually rely on MirrorMaker for copying between clusters.
MirrorMaker consumes and then produces records through a separate Connect service and usually changes offsets. Cluster Linking copies raw bytes inside the brokers, keeps offsets identical and needs no extra service, but it cannot transform data.
A read-only topic in the destination cluster that stays in step with a topic in the source. It becomes a normal writable topic only after promotion or failover.
Records are copied byte for byte into the same partitions at the same positions. Consumers can therefore switch clusters and continue from a saved offset without complicated translation.
Promote is a planned conversion that waits for the mirror to catch up fully, so nothing is lost, and needs a healthy source. Failover converts immediately when the source is unavailable, and may lose records that were not yet copied.
No, not while it is a mirror. Applications can only read. After promotion or failover, it becomes a normal topic that accepts writes.
Not in an emergency. Copying is asynchronous, so recent records may be missing after a failover. A planned promotion with a healthy source does not lose data.
No. The link copies topic data. Schemas in a schema registry need their own arrangement so that applications in the destination can decode the records.
No. Records are copied unchanged. If you need changes, add a stream processing step on the destination that reads the mirror and writes a new topic.
Link status, the state of each mirror topic, mirroring lag, throughput, consumer offset sync health and the load on both clusters. Alert on anything that shows the copy has stopped or is falling behind.
Not to the same mirrored topic. Because mirrors are read-only, each region should own different topics, typically with region prefixes, and readers combine them.
24Summary and Key Takeaways
Cluster Linking connects two Kafka clusters so that the destination cluster fetches chosen topics directly from the source and stores exact, read-only copies, called mirror topics, with the same partitions, offsets and timestamps. Because the copying happens inside the brokers and needs no separate service, it is simpler to run than traditional copy tools, and because offsets are preserved, moving consumers between clusters becomes far easier. It fits migrations, disaster recovery, hybrid and multi-cloud sharing and local reads. Mirror topics turn into normal topics through promotion, which waits for a full catch-up, or failover, which acts immediately and may lose recent data. The feature belongs to Confluent Platform and Confluent Cloud, cannot transform data and leaves schemas, applications and connectors for you to plan. With careful topic selection, narrow security identities, good monitoring and regular drills, it becomes a dependable bridge between clusters.
Key Takeaways
- It mirrors, it does not re-produce — the destination fetches raw bytes from the source and stores them at the same offsets.
- Mirror topics are read-only — they become writable only after promotion or failover.
- Preserved offsets simplify moves — consumers can switch clusters without complicated offset translation, with optional consumer offset syncing.
- Promote for planned moves, fail over for emergencies — promotion waits for zero lag, failover is immediate and may lose recent records.
- It is a Confluent feature — open-source Kafka users typically use MirrorMaker, which is more flexible but has more moving parts.
- Plan the whole ecosystem — schemas, applications, connectors and access rules do not travel automatically.
- Secure and monitor the link — use a dedicated least-privilege identity, encrypted connections, and alerts on link status and mirroring lag.
- Practise recovery — rehearse failover and failback, and know your real recovery point and recovery time.