Replication
Replication Strategies in Azure Storage¶
Here’s a detailed overview of replication strategies in Azure Storage, why they matter, and when to use each:
1. Why Replication Matters¶
Azure Storage replication ensures high availability, durability, and disaster recovery by keeping multiple copies of your data.
- Guarantees 99.999999999% (11 9s) durability for objects.
- Protects against hardware failures, datacenter outages, and regional disasters.
2. Azure Storage Replication Options¶
Azure provides four main replication strategies for Blob, File, Queue, and Table Storage:
Strategy | Acronym | Description | Pros | Cons | Use Cases |
---|---|---|---|---|---|
Locally Redundant Storage | LRS | Keeps 3 copies of data within a single datacenter. | Low cost, low latency | Data lost if entire datacenter fails | Non-critical apps, dev/test, temporary data |
Zone-Redundant Storage | ZRS | Keeps 3 copies across availability zones in the same region. | High availability, survives zone failures | Slightly higher cost | Production workloads needing SLA uptime |
Geo-Redundant Storage | GRS | Keeps 6 copies: 3 in primary region, 3 in secondary region. | Protects against regional disasters | Higher latency for secondary region; read access not automatic | Disaster recovery, backup data |
Read-Access Geo-Redundant Storage | RA-GRS | Same as GRS but allows read access from the secondary region. | DR-ready, read scalability | Higher cost, eventual consistency | Global read-heavy apps, disaster recovery |
3. How Replication Works¶
-
LRS:
-
All copies in the same datacenter.
-
Protects against hardware failure, but not datacenter outage.
-
ZRS:
-
Copies are in different Availability Zones in the same region.
-
Protects against zone failure (power/network outage in one zone).
-
GRS / RA-GRS:
-
Data is asynchronously replicated to a secondary region hundreds of miles away.
- RA-GRS allows reads from the secondary region, GRS does not.
- There is a small replication lag (~15 minutes).
4. Choosing a Strategy¶
Requirement | Recommended |
---|---|
Low cost, dev/test | LRS |
High availability in region | ZRS |
Disaster recovery across regions | GRS |
DR + read scalability | RA-GRS |
5. Setting Replication in Azure¶
Azure Portal:
- Go to Storage Account → Settings → Configuration → Replication.
- Choose LRS, ZRS, GRS, or RA-GRS.
- Click Save.
Azure CLI Example:
az storage account create \
--name mystorageacct \
--resource-group myResourceGroup \
--location eastus \
--sku Standard_LRS \
--kind StorageV2
To change replication after creation:
az storage account update \
--name mystorageacct \
--resource-group myResourceGroup \
--sku Standard_GRS
6. Notes / Best Practices¶
- Use ZRS for production workloads within a region for high availability.
- Use GRS or RA-GRS for critical workloads needing regional disaster recovery.
- Cost increases with more durable replication options (ZRS < GRS < RA-GRS).
- RA-GRS allows read access from the secondary region without failover.
✅ Summary
Replication strategies in Azure allow you to balance cost, availability, and disaster recovery requirements:
- LRS → Cheap, protects against hardware failure.
- ZRS → Protects against zone failure.
- GRS → Protects against regional disaster, read/write in primary.
- RA-GRS → Same as GRS + read access from secondary.