MirrorMaker 2双向同步场景咨询:每个需复制主题是否在链路两端各需6个系统主题?主题爆炸风险探讨
Great question—this is a super common concern when setting up bidirectional Kafka syncs with MirrorMaker 2 (MM2), so let’s break this down clearly to ease your worries.
First, let’s correct a critical misunderstanding: MM2 does NOT create 6 system topics per replicated business topic. Instead, system topics are tied to replication links (the sync relationship between a source and target cluster), not individual business topics. That’s the key detail that prevents "topic explosion."
What System Topics Does MM2 Actually Create?
For a single unidirectional replication link (e.g., Cluster A → Cluster B), MM2 generates a fixed set of system topics (typically 5-6, depending on your config) on the target cluster. These include:
mm2-[source-cluster]-to-[target-cluster]-heartbeats: Tracks liveness of MM2 workersmm2-[source-cluster]-to-[target-cluster]-checkpoints: Stores offset checkpoints for replicated topicsmm2-[source-cluster]-to-[target-cluster]-offsets: Maps source topic offsets to target offsetsmm2-[source-cluster]-to-[target-cluster]-status: Tracks replication task health and progressmm2-[source-cluster]-to-[target-cluster]-configs: Stores dynamic configuration for the replication link- (Optional)
mm2-[source-cluster]-to-[target-cluster]-topics: Used if you’re auto-discovering topics to replicate
Bidirectional Sync: How This Scales
Bidirectional sync is just two separate unidirectional links working in tandem: Cluster A → Cluster B, and Cluster B → Cluster A. Each link gets its own set of system topics:
- On Cluster B, you’ll have the 5-6 system topics for the A→B link
- On Cluster A, you’ll have the 5-6 system topics for the B→A link
The total number of system topics here is 10-12 across both clusters—no matter how many business topics you’re replicating. Even if you sync 1000+ business topics, you still only have these 10-12 system topics. That’s a night-and-day difference from the per-topic scenario you were worried about.
Quick Tips to Keep Things Clean
If you want to minimize clutter even further:
- Customize the system topic prefix with the
mm2.prefixconfig to group them neatly - Disable optional system topics if you don’t need them (e.g., turn off auto-discovery if you’re explicitly listing topics to sync)
- Use Kafka’s built-in topic filtering tools to separate system topics from your business topics in monitoring UIs
内容的提问来源于stack exchange,提问作者teeboy

