Saltar a contenido

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

  1. LRS:

  2. All copies in the same datacenter.

  3. Protects against hardware failure, but not datacenter outage.

  4. ZRS:

  5. Copies are in different Availability Zones in the same region.

  6. Protects against zone failure (power/network outage in one zone).

  7. GRS / RA-GRS:

  8. Data is asynchronously replicated to a secondary region hundreds of miles away.

  9. RA-GRS allows reads from the secondary region, GRS does not.
  10. 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:

  1. Go to Storage Account → Settings → Configuration → Replication.
  2. Choose LRS, ZRS, GRS, or RA-GRS.
  3. 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.