Azure Storage blob object replication provides asynchronous replication of block blobs from one storage account to another. The blobs are replicated based on the defined replication rules.
Using object replication requires that the blob versioning options are enabled for both the source and destination storage accounts. Additionally, the source storage account must have the blob change feed enabled. If these settings are not enabled, they will be enabled automati- cally when you create the first replication rule. These settings might increase the costs of the storage account.
There are various benefits you can get by using object replication:
- For large data processing jobs, you can analyze the data in a single region, and you can distribute results to additional regions as needed. This saves processing time and com- pute resources to perform the same in all regions.
- With replication, the users can read data from the replicated region as well. Hence, you can reduce latency for your read requests by giving them the flexibility to choose the nearest region to read the data.
- Compute workloads can now process the same sets of block blobs in different regions using object replication.
- You can reduce the costs by moving your replicated data to the archive tier using lifecycle management policies.
Keep in mind that object replication performs multiple read and write transactions against the source and destination accounts. This can incur additional costs.
To set up the object replication rules, open the storage account, browse to Object Replica- tion under Data Management, and click Create Replication Rules (see Figure 2-22). You can define up to 10 replication rules per policy using the Azure portal, or up to 1,000 if you use JSON to upload the rules.
FIGURE 2-22 Create Replication Rules option on the Object Replication blade
You need to select the destination subscription and destination storage account that will be used for replication. You also need to select the source containers and destination containers in a pair. You can limit the replication scope with filters by specifying the prefix match for blobs. See Figure 2-23.
FIGURE 2-23 The Create Replication Rules blade with destination and container pair details
You can also control how objects are copied to the destination container using three options: Everything, Only New Objects, and Custom. If you select Everything, then all the blobs matching the filters will be copied to the destination container, but if you select Only New Objects, only the newly added blobs matching the filters will be copied to the destination con- tainer. If you select Custom, you will have a chance to manually specify a date and time to copy the blobs created later, as shown in Figure 2-24.
FIGURE 2-24 Copy Over option for a replication rule
Once created, the consolidated view of replication rules can be viewed by visiting the Object Replication blade. You can also right-click a rule and select Edit Rules or Download Rules, as shown in Figure 2-25. The downloaded rules can be edited and reused using the Upload Replication Rules options instead of re-creating them.
To check the replication status of a source blob, select the source blob to see its properties. The Object Replication section shows the replication Policy ID, Rule ID, and Status (see Figure 2-26).
FIGURE 2-26 Replication status
There are certain limitations with blob object replication that are crucial to review before implementation:
- Object replication doesn’t work with the Archive tier.
- Blob snapshots and immutable snapshots are not supported with object replication.
- Object replication doesn’t work with accounts with a hierarchical namespace (Azure Data Lake Storage Gen2).
- Because block blob data is replicated asynchronously, there is no SLA on when accounts are in sync. However, you can check the replication status of a blob.
- The source account can only have a maximum of two destination accounts.
- Once you create a replication policy, the destination container is read-only, and you can no longer perform write operations against it.