Multi-AZ Kafka Architecture | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
| Deploying Apache Kafka across multiple Availability Zones (Multi-AZ) ensures high availability, fault tolerance, and disaster recovery. If an entire data center (AZ) goes down, Kafka continues to operate without data loss.
1. Architecture DiagramBelow is the conceptual architecture of a 3-way Multi-AZ Kafka deployment using 3 Availability Zones (AZ-A, AZ-B, AZ-C).
2. Key Architectural Concepts1) Odd Number of AZs (Minimum 3)
2) Rack Awareness ( |
| Parameter | Recommended Value | Description |
|---|---|---|
broker.rack | us-east-1a (Matches AZ) | Identifies the physical location of the broker. Kafka uses this to distribute replicas. |
replica.selector.class | org.apache.kafka.common.replica.RackAwareReplicaSelector | Allows consumers to read from the nearest follower (in the same AZ) to reduce cross-AZ data transfer costs. |
| Parameter | Recommended Value | Description |
|---|---|---|
replication.factor | 3 | Ensures there are 3 copies of the data, ideally one in each of the 3 AZs. |
min.insync.replicas | 2 | Specifies the minimum number of replicas that must acknowledge a write for it to be considered successful when acks=all. |
| Parameter | Recommended Value | Description |
|---|---|---|
acks | all (or -1) | The leader broker will wait for the full set of in-sync replicas (ISR) to acknowledge the record before responding to the client. |
retries | 2147483647 (Max Int) | Allows the producer to automatically retry sending messages during transient failures (e.g., AZ failover). |

acks=all and min.insync.replicas=2 were configured, the data was already safely replicated to AZ-B and AZ-C before the crash.