Scenario 20.1.5 · Bidirectional links and clean failback
Kafka failover and failback with Confluent Cluster Linking
Cluster Linking is offset-preserving, so you can switch the active cluster over to the mirror and later switch BACK - the link reverses in place and offsets stay consistent end to end, with no reprocess window.
Run this scenario in the playgroundOne cluster link, primary → dr. t+0.000s
A cluster link mirrors orders from primary into a read-only mirror of the same name, orders on dr: the link sets no cluster.link.prefix (Confluent's reverse commands refuse prefixed links, so a reversible mirror is called orders on both sides). Cluster Linking is offset-preserving, so the mirror will hold the same records at the same offsets.
Open at this step: step 1, One cluster link, primary → drForward mirror (offset-preserving). t+0.700s
Three records on orders (primary) are mirrored byte-for-byte into orders (dr) at identical offsets - both at high-watermark 3. orders on dr is a read-only mirror.
Open at this step: step 2, Forward mirror (offset-preserving)Switchover: promote + reverse. t+1.050s
switch_cluster_link promotes orders to writable on dr, DEMOTES orders to a read-only mirror on primary, and reverses the link in place (dr → primary) so it mirrors back into orders on primary. The read-only state is per region: the same name is writable on one side and a mirror on the other.
Open at this step: step 3, Switchover: promote + reverseProduce on the new primary; mirror back. t+1.500s
A dr-local producer appends O4 to the promoted orders on dr at offset 3. The reversed link mirrors it back into orders on primary at the SAME offset 3 - both at high-watermark 4.
Open at this step: step 4, Produce on the new primary; mirror backSwitchback: promote + reverse again. t+1.750s
switch_cluster_link promotes orders back to writable on primary, demotes orders on dr to a read-only mirror, and reverses the link forward again (primary → dr).
Open at this step: step 5, Switchback: promote + reverse againOffsets consistent end to end. t+2.200s
O5 produced on the restored primary lands at offset 4 and is mirrored forward to orders on dr at the SAME offset 4. Both copies now hold offsets 0..4 identically - no reprocess window, no data loss.
Open at this step: step 6, Offsets consistent end to endWhat you start with
Because Cluster Linking copies records at identical offsets, failover can be clean and reversible: promote the mirror to writable (switchover), produce on it, then later promote the original back (switchback). Each switch reverses the link in place, and no offsets are ever remapped.
Step by step
- One cluster link, primary → dr t+0.000s A cluster link mirrors orders from primary into a read-only mirror of the same name, orders on dr: the link sets no cluster.link.prefix (Confluent's reverse commands refuse prefixed links, so a reversible mirror is called orders on both sides). Cluster Linking is offset-preserving, so the mirror will hold the same records at the same offsets. Open at this step: step 1, One cluster link, primary → dr
- Forward mirror (offset-preserving) t+0.700s Three records on orders (primary) are mirrored byte-for-byte into orders (dr) at identical offsets - both at high-watermark 3. orders on dr is a read-only mirror. Open at this step: step 2, Forward mirror (offset-preserving)
- Switchover: promote + reverse t+1.050s switch_cluster_link promotes orders to writable on dr, DEMOTES orders to a read-only mirror on primary, and reverses the link in place (dr → primary) so it mirrors back into orders on primary. The read-only state is per region: the same name is writable on one side and a mirror on the other. Open at this step: step 3, Switchover: promote + reverse
- Produce on the new primary; mirror back t+1.500s A dr-local producer appends O4 to the promoted orders on dr at offset 3. The reversed link mirrors it back into orders on primary at the SAME offset 3 - both at high-watermark 4. Open at this step: step 4, Produce on the new primary; mirror back
- Switchback: promote + reverse again t+1.750s switch_cluster_link promotes orders back to writable on primary, demotes orders on dr to a read-only mirror, and reverses the link forward again (primary → dr). Open at this step: step 5, Switchback: promote + reverse again
- Offsets consistent end to end t+2.200s O5 produced on the restored primary lands at offset 4 and is mirrored forward to orders on dr at the SAME offset 4. Both copies now hold offsets 0..4 identically - no reprocess window, no data loss. Open at this step: step 6, Offsets consistent end to end
The takeaway
After a full switchover and switchback both clusters hold the same records at the same offsets - there is no reprocess window and no data loss. Offset preservation is what makes Cluster Linking failover and failback clean and bidirectional.
Embed this scenario
Paste this into a blog post, a course page or your team's docs. The scenario plays inside your page, and the link under it points readers to this walkthrough.
<iframe src="https://monedula.dev/kafka-simulator/embed/?scenario=20.1.5" title="Kafka Simulator: Bidirectional links and clean failback" width="100%" height="520" style="border:1px solid #d0d0d0;border-radius:8px" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
<p><a href="https://monedula.dev/kafka-simulator/scenarios/bidirectional-links-failback/">Kafka failover and failback with Confluent Cluster Linking</a></p> Further reading
Kafka proposals behind this scenario
More in Cluster mirroring
- Confluent Cluster Linking: offset-preserving Kafka mirroring
- Kafka mirror topics (Confluent): read-only until promoted
- Cluster Linking vs MirrorMaker 2 for Kafka replication
- Kafka consumer offset sync: Cluster Linking vs MirrorMaker 2
- Apache Kafka Cluster Mirroring (KIP-1279): stop and failback
- kaf-mirror failover: Kafka consumers re-read from earliest
- kaf-mirror failover: latest skips unread Kafka records
- kaf-mirror vs MirrorMaker 2: Kafka failover resume points