Cluster Linking is an official Confluent feature in which brokers replicate directly to each other, copying partitions, records, and offsets one-to-one. This minimizes consumer rebalancing and offset translation during migrations and DR scenarios.
This article covers the design considerations for offset-preserving replication and migration, a phased cutover procedure, monitoring and verification, and the differentiators most commonly tested on the CCAAK exam.
Cluster Linking is server-side replication in which the destination cluster fetches data from the source via a link. Unlike MirrorMaker 2, there is no external connector — a per-topic "mirror" is created on the destination that preserves the source topic's partition layout, ordering, and the exact offset of every record.
Because offsets are preserved, consumers can resume from the same numeric offset after a cluster switch. The offset translation and consistency wait times that were previously required are largely eliminated, simplifying DR, region migrations, and blue-green deployments.
Offset-preservation overview (same partition, same offset)
Minimal link creation (executed on the destination cluster)
# 宛先: リンク作成(プロパティファイルで安全に資格情報を保持)\n# link-src.properties 例\n# bootstrap.servers=src-broker:9092\n# security.protocol=SASL_SSL\n# sasl.mechanism=PLAIN\n# sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username=\"...\" password=\"...\";\n\n# 宛先でリンクを作成\n$ kafka-cluster-links \\\n --bootstrap-server dest-broker:9092 \\\n --create --link src-to-dest \\\n --config-file link-src.properties\n\n# ミラートピック作成(orders を元からミラー)\n$ kafka-mirrors \\\n --bootstrap-server dest-broker:9092 \\\n --create --mirror-topic orders --link src-to-destWith Cluster Linking, each mirror-topic partition fetches from the matching source partition and preserves every record's offset, timestamp, and headers. Consumers therefore need no offset translation during a cluster switch, and seek semantics remain consistent.
However, consumers may not resume cleanly unless the following conditions are met. In particular, the destination cannot accept writes while the topic is mirrored, so writes must remain directed at a single cluster until full cutover is complete.
| Item | Cluster Linking | MirrorMaker 2 (for comparison) |
|---|---|---|
| Offsets | Record offsets are preserved (no translation needed) | Usually requires translation (via Offset Sync) |
| Execution model | Built-in broker feature (server-side) | Connector running on Kafka Connect workers |
| Latency | Low to medium (broker-to-broker fetch) | Medium (overhead from the connector hop) |
| One-way / two-way | Multiple one-way links by design | Bidirectional is possible but adds complexity |
| Cutover procedure | Promote the mirror and reconcile group offsets | Centered on stopping producers/consumers and translating offsets |
Inspecting mirror state (lag and health)
# リンク/ミラーの記述\n$ kafka-cluster-links --bootstrap-server dest:9092 --describe --link src-to-dest\n$ kafka-mirrors --bootstrap-server dest:9092 --describe --mirror-topic orders\n\n# 代表的な遅延メトリクス(JMX名は環境によりプレフィックス差異あり)\n# kafka.server: type=ReplicaFetcherManager,name=MaxLag,clientId=*,link=src-to-dest\n# kafka.server: type=MirrorTopicMetrics,name=TimeLag,topic=ordersMigration: Keep producing to the existing cluster (source), let the destination mirror catch up, promote when caught up, and switch writes over. Thanks to offset preservation, consumers can keep reading from the same offsets.
DR: Mirror one-way in steady state. On failure, promote the mirror on the destination and switch producers and consumers over. After recovery, create a new link in the reverse direction (avoid simultaneous two-way writes to prevent split-brain).
Minimal sequence for promotion and write switchover
# 1) 生産を短時間停止(ソースの最終レコードまで追いつかせる)\n# 2) 宛先でミラーを昇格(以後、通常トピック)\n$ kafka-mirrors --bootstrap-server dest:9092 --promote --mirror-topic orders\n# 3) プロデューサのbootstrap.serversを宛先に変更して再開\n# 4) コンシューマは同じgroup.id/オフセットで継続(次節のオフセット整合参照)Cluster Linking preserves record offsets, but consumer group commits live in a separate topic, so it is safer not to assume automatic migration. The procedure below minimizes downtime while cutting over at the same offsets.
Note: relying on the default auto.offset.reset=latest/earliest behavior will shift the resume position, so align group offsets explicitly on the destination.
Pre-aligning group offsets (example: single topic, few partitions)
# 1) ソースで現在のコミット位置を確認\n$ kafka-consumer-groups --bootstrap-server src:9092 --describe --group app-g1 \\n --topic orders\n# 出力から各partitionのCURRENT-OFFSETを控える(p0=1043, p1=879 など)\n\n# 2) 宛先で同じgroup.idに対し、手動で同値を設定\n$ kafka-consumer-groups --bootstrap-server dest:9092 --group app-g1 \\n --topic orders --reset-offsets --to-offset 1043 --partition 0 --execute\n$ kafka-consumer-groups --bootstrap-server dest:9092 --group app-g1 \\n --topic orders --reset-offsets --to-offset 879 --partition 1 --execute\n\n# 3) ミラーを昇格し、コンシューマ/プロデューサを宛先に切替\n$ kafka-mirrors --bootstrap-server dest:9092 --promote --mirror-topic ordersLag is the heart of any cutover go/no-go decision. Monitor TimeLag/RecordsLag, link health, and fetch errors, and define an acceptable lag threshold. Be careful with cases where network bandwidth or differing retention.ms values stall progress.
Configuration drift causes unexpected behavior. Verify cleanup.policy, min.insync.replicas, compression.type, and other settings at the time the mirror is created, and change them explicitly after promotion if needed. Treat ACLs/RBAC as a separate concern and distribute access rights ahead of cutover.
Example: simple health check and lag retrieval
# Describeでリンクとミラーの状態を点検\n$ kafka-cluster-links --bootstrap-server dest:9092 --describe --link src-to-dest | sed -n '1,200p'\n$ kafka-mirrors --bootstrap-server dest:9092 --describe --mirror-topic orders\n\n# JMXをcurl/jolokia等で取得し、TimeLagがしきい値未満であることを確認\n# 例: curl http://jolokia:8778/jolokia/read/kafka.server:type=MirrorTopicMetrics,name=TimeLag,topic=ordersCluster Linking's biggest differentiator is record offset preservation. Lock in three points: no translation step like MirrorMaker 2's Offset Sync, the mirror topic is read-only on the destination, and promotion turns it into a regular topic.
The exam frequently asks where the feature lives (broker vs. Connect), what operations are required at cutover (promote, align group offsets), and design choices like avoiding dual writes.
Quick recap (mnemonic via pseudo-commands)
# create link -> create mirror -> catch up -> promote -> switch clients\n# オフセット保持: 変換不要。グループオフセット: 手動整合/移行を計画。CCAAK
問題 1
You want to migrate the topic orders from existing cluster A to new cluster B with minimal downtime. You created a mirror topic via Cluster Linking and it has fully caught up. To leverage offset preservation and keep consuming from the same position, which is the most appropriate next step?
正解: A
Cluster Linking preserves record offsets, but group commits are not migrated automatically. The safe path is to promote and then explicitly align the same group.id's offsets on the destination before switching. Relying on `latest` or mirroring __consumer_offsets directly is inappropriate, and direct writes to a mirror topic are not permitted.
Can I change the partition count of a mirror topic?
While the topic is mirrored it tracks the source topic's partition layout, so you cannot change it independently on the destination. After promotion it becomes a regular topic, and you can expand partitions within the usual Kafka constraints.
Are ACLs and RBAC replicated together with the link?
Authorization is independent of data replication. The recommended practice is to provision the required permissions on the destination in advance and distribute them before cutover.
How are transactions and Exactly-Once Semantics (EOS) handled?
Cluster Linking preserves record order and offsets, but transaction boundaries are not shared across clusters. Keep transactional writes contained within a single cluster, and follow the stop → promote → resume sequence at cutover to maintain consistency.
Practice with certification-focused question sets
無料で問題を解いてみるNicheeLab Editorial Team
NicheeLab editorial team focused on data engineering and cloud certification learning. Content is structured around practical study needs and official exam domains.
Kafka Topics & Partitions: Distribution Fundamentals (2026)
How Kafka topics and partitions enable scale — ordering guar...
CCDAK Exam Guide: Confluent Certified Developer (2026)
Complete prep for the CCDAK exam — Producer/Consumer API, St...
CCAAK Exam Guide: Confluent Certified Administrator (2026)
Pass the CCAAK exam — cluster management, partitions, securi...
Kafka Replicas & ISR: Fault Tolerance Explained (2026)
Replica placement, in-sync replicas (ISR), leader election. ...
Kafka Offsets: Commit Modes & Consumer Position (2026)
Offset semantics — auto vs. manual commit, __consumer_offset...