Using MirrorMaker for Replication
1. Understanding MirrorMaker Architecture
| Component | Description | Detail |
|---|---|---|
| MM2 | Connect-based | Modern |
| MirrorSource | Replicates topics | Connector |
| Checkpoint | Offset translation | Failover |
2. Configuring MirrorMaker 2.0
| Config | Description | Detail |
|---|---|---|
| clusters | Named aliases | src, dst |
| bootstrap.servers | Per cluster | Endpoints |
| enabled | Activate flow | Direction |
Example: mm2.properties
clusters=src,dst
src.bootstrap.servers=src1:9092
dst.bootstrap.servers=dst1:9092
src->dst.enabled=true
3. Setting Source Cluster
| Config | Description | Detail |
|---|---|---|
| src.bootstrap | Origin brokers | Read from |
| Security | SASL/SSL per cluster | src.security |
| Prefix | Alias-scoped config | src.* |
4. Setting Target Cluster
| Config | Description | Detail |
|---|---|---|
| dst.bootstrap | Destination brokers | Write to |
| Naming | src.topic by default | Prefix |
| replication.factor | For mirrored topics | dst RF |
5. Configuring Topic Replication
| Config | Description | Detail |
|---|---|---|
| topics | Regex of topics | Whitelist |
| topics.exclude | Blacklist | Skip |
| sync.topic.configs | Mirror configs | Keep aligned |
6. Setting Replication Flow
| Mode | Description | Detail |
|---|---|---|
| Active-Passive | One direction | DR standby |
| Active-Active | Bidirectional | Both enabled |
| Loop Prevention | Prefix avoids cycles | Built-in |
7. Configuring Consumer Groups Sync
| Config | Description | Detail |
|---|---|---|
| sync.group.offsets | Mirror group offsets | Failover |
| groups | Regex of groups | Which to sync |
| emit.checkpoints | Offset translation | Mapping |
8. Setting ACLs Replication
| Config | Description | Detail |
|---|---|---|
| sync.topic.acls | Mirror ACLs | Security parity |
| Interval | Periodic refresh | Sync freq |
| Read-Only | Mirrored topics | Recommended |
9. Configuring Heartbeat Connectors
| Aspect | Description | Detail |
|---|---|---|
| MirrorHeartbeat | Emits heartbeats | Liveness |
| heartbeats topic | Internal topic | Probe |
| Lag Measure | Detect flow health | Monitoring |
10. Monitoring Replication Lag
| Metric | Description | Detail |
|---|---|---|
| replication-latency-ms | Source to target delay | Freshness |
| record-count | Records mirrored | Throughput |
| checkpoint-latency | Offset sync delay | Failover RPO |