In today’s digital landscape, cross-region replication has become a foundational feature for any managed database service aiming to provide high availability, disaster recovery, and global scalability. Ensuring data continuity and availability even during regional outages or unexpected events is essential, and Azure Cosmos DB for MongoDB (vCore) now offers a robust generally available (GA) cross-region replication feature designed to meet these needs. This feature empowers organizations to maintain a complete replica of their data in another Azure region, enabling seamless disaster recovery (DR) and scalable, globally distributed read access.
Cross-region replication as a part of disaster recovery strategy
Cross-region replication in Azure Cosmos DB for MongoDB (vCore) allows you to establish a replica cluster in Region B, providing a full, constantly synchronized copy of your data in Region A. This setup offers a safety net in case of unexpected outages, where the replica in Region B can take over seamlessly to ensure data remains accessible and operational.
For production workloads, cross-region disaster recovery adds a layer of resiliency to the cluster availability strategy enabled by the in-region high availability (HA) and business continuity delivered by cluster backup/restore.
Disaster recovery that’s always ready
When cross-region replication is enabled, a replica of your cluster in another Azure region ensures readiness for disaster recovery. In the rare event of an Azure region experiencing an outage, you can switch writes from the primary cluster in Region A to the replica cluster in Region B. With this capability, your application continues to work without interruption. Using a global read-write connection string, you can dynamically direct write operations to the active region, minimizing impact on users or applications. The system also supports cluster role reversals, allowing you to switch cluster roles back when Region A is fully operational again, maintaining flexibility and uptime.
Enhanced read scalability for distributed applications
Another benefit of cross-region replication is the ability to scale read operations. With a replica cluster, you can offload heavy read workloads from the primary cluster to the replica. This approach not only balances the load but can also reduce latency for applications located closer to the replica, optimizing read performance and end-user experience.
How to create and promote a replica cluster in Azure Cosmos DB for MongoDB (vCore)
In Azure Cosmos DB for MongoDB (vCore), you have the flexibility to add a replica cluster either during initial provisioning or later as part of an existing setup. Many MongoDB workloads benefit from being tested and fine-tuned on a standalone cluster first to optimize cluster parameters as well as compute and storage configuration for specific workload needs. Once the operational parameters are fully optimized, it’s time to activate essential production features like cross-region replication, which ensures data resilience and global accessibility.
To add a replica cluster to an existing Azure Cosmos DB for MongoDB (vCore) instance, follow these steps:
- Follow the steps to create a new Azure Cosmos DB for MongoDB (vCore) cluster.
- Once cluster is created, on the cluster sidebar, under Settings, select Global distribution.
- Select Add new read replica. Figure 1. Screenshot from the Azure portal of a cluster’s ‘Global distribution’ page.
- Provide a replica cluster name in the Read replica name field.
- Select a region in the Read replica region. The replica cluster is hosted in the selected Azure region.
- Verify your selection and select the Save button to confirm replica creation. Figure 2. Screenshot from the Azure portal of the ‘Global distribution’ page with new cluster replica information.
Once your replica cluster is set up, here are a few key things to consider:
- Network configuration: If the replica cluster will support read operations, adjust networking settings to enable either public or private access.
- Global connection string: Start using the global read-write connection string in your application to simplify switchover to Region B in the event of an outage affecting the primary cluster in Region A. Figure 3. Screenshot from the Azure portal of the ‘Connection strings’ page with the global read-write connection string.
- Switchover testing: Test your application by promoting the replica cluster to read-write mode, following the steps outlined in the next section.
- Note: You can switch the primary (read-write) and replica (read-only) regions anytime by promoting the replica cluster.
To promote replica cluster to become available for writes, perform the following steps:
- On the replica cluster sidebar, under Settings, select Global distribution.
- Select Promote in the toolbar. If you don’t see ‘Promote’ in the toolbar on the ‘Global distribution page’, make sure it is the replica cluster and not the primary cluster. Figure 4. Screenshot from the Azure portal of the replica cluster’s ‘Global distribution’ page.
- Select Promote in the ‘Promote cluster’ window. Replica cluster continues to be available for reads while writes are being enabled. Figure 5. Screenshot from the Azure portal of the replica cluster’s promotion confirmation window.
A key component of your disaster recovery strategy
Cross-region replication in Azure Cosmos DB for MongoDB (vCore) is a vital feature for any production-grade environment, ensuring cross-region data redundancy, read scalability, and uninterrupted access. This capability is available across all cluster configurations, excluding burstable compute options meant for development and testing.
With the recent introduction of large storage sizes up to 32 TiB and performance scaling up to 20,000 IOPS per physical shard, Azure Cosmos DB for MongoDB (vCore) can easily accommodate production-grade workloads of all sizes. For organizations handling hundreds of terabytes, additional physical shards can be deployed for further scalability in a sharded MongoDB database.
Azure Cosmos DB for MongoDB (vCore)’s cross-region replication is a crucial component for robust disaster recovery strategies, meeting both multi-region availability and global scalability needs to always keep mission-critical data accessible.
Next steps: Cross-region DR and read scalability in Azure Cosmos DB for MongoDB (vCore)
Whether you are interested in cross-region disaster recovery, or setting up a read replica in another region, or both, you can try the cross-region replication feature in preview today.
- Check out details about how cross-region replication works
- Follow these steps to enable cross-region replication on your next Azure Cosmos DB for MongoDB (vCore) cluster
Leave a review
Tell us about your Azure Cosmos DB experience! Leave a review on PeerSpot and we’ll gift you $50. Get started here.
About Azure Cosmos DB
Azure Cosmos DB is a fully managed and serverless NoSQL and vector database for modern app development, including AI applications. With its SLA-backed speed and availability as well as instant dynamic scalability, it is ideal for real-time NoSQL and MongoDB applications that require high performance and distributed computing over massive volumes of NoSQL and vector data.
Try Azure Cosmos DB for free here. To stay in the loop on Azure Cosmos DB updates, follow us on X, YouTube, and LinkedIn.
0 comments
Be the first to start the discussion.