{"id":8975,"date":"2024-11-19T05:30:49","date_gmt":"2024-11-19T13:30:49","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cosmosdb\/?p=8975"},"modified":"2024-11-13T07:11:50","modified_gmt":"2024-11-13T15:11:50","slug":"achieving-production-readiness-with-cross-region-replication-in-azure-cosmos-db-for-mongodb-vcore","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cosmosdb\/achieving-production-readiness-with-cross-region-replication-in-azure-cosmos-db-for-mongodb-vcore\/","title":{"rendered":"Achieving Production Readiness with Cross-Region Replication in Azure Cosmos DB for MongoDB (vCore)"},"content":{"rendered":"<p>In today&#8217;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.<\/p>\n<p><iframe src=\"\/\/www.youtube.com\/embed\/Zpx3oFbEfWQ\" width=\"560\" height=\"314\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<h1>Cross-region replication as a part of disaster recovery strategy<\/h1>\n<p>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.<\/p>\n<p>For production workloads, cross-region disaster recovery adds a layer of resiliency to the cluster availability strategy enabled by <a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/mongodb\/vcore\/high-availability\">the in-region high availability (HA)<\/a> and business continuity delivered by <a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/mongodb\/vcore\/how-to-restore-cluster\">cluster backup\/restore<\/a>.<\/p>\n<h2>Disaster recovery that\u2019s always ready<\/h2>\n<p>When cross-region replication is enabled, a replica of your cluster in another Azure region ensures readiness for disaster recovery. In the <em>rare<\/em> 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 <em>global read-write connection string<\/em>, 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.<\/p>\n<h2>Enhanced read scalability for distributed applications<\/h2>\n<p>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.<\/p>\n<h2>How to create and promote a replica cluster in Azure Cosmos DB for MongoDB (vCore)<\/h2>\n<p>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\u2019s time to activate essential production features like cross-region replication, which ensures data resilience and global accessibility.<\/p>\n<p>To add a replica cluster to an existing Azure Cosmos DB for MongoDB (vCore) instance, follow these steps:<\/p>\n<ul>\n<li>Follow the steps to\u00a0<a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/mongodb\/vcore\/quickstart-portal#create-a-cluster\">create a new Azure Cosmos DB for MongoDB (vCore) cluster<\/a>.<\/li>\n<li>Once cluster is created, on the cluster sidebar, under\u00a0<strong>Settings<\/strong>, select\u00a0<strong>Global distribution<\/strong>.<\/li>\n<li>Select\u00a0<strong>Add new read replica<\/strong>.<a href=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-distribution-add-replica.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-8976\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-distribution-add-replica.png\" alt=\"MongoDB vCore global distribution page in Azure portal with add replica circled\" width=\"1443\" height=\"880\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-distribution-add-replica.png 1443w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-distribution-add-replica-300x183.png 300w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-distribution-add-replica-1024x624.png 1024w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-distribution-add-replica-768x468.png 768w\" sizes=\"(max-width: 1443px) 100vw, 1443px\" \/><\/a>\n<em>Figure 1. Screenshot from the Azure portal of a cluster\u2019s \u2018Global distribution\u2019 page.<\/em><\/li>\n<li>Provide a replica cluster name in the\u00a0<strong>Read replica name<\/strong>\u00a0field.<\/li>\n<li>Select a region in the\u00a0<strong>Read replica region<\/strong>. The replica cluster is hosted in the selected Azure region.<\/li>\n<li>Verify your selection and select the\u00a0<strong>Save<\/strong>\u00a0button to confirm replica creation.<em><a href=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-distribution-new-replica.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-8977\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-distribution-new-replica.png\" alt=\"Screenshot of MongoDB vCore global distribution page with new replica information entered in Azure portal \" width=\"1508\" height=\"878\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-distribution-new-replica.png 1508w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-distribution-new-replica-300x175.png 300w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-distribution-new-replica-1024x596.png 1024w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-distribution-new-replica-768x447.png 768w\" sizes=\"(max-width: 1508px) 100vw, 1508px\" \/><\/a>\nFigure 2. Screenshot from the Azure portal of the \u2018Global distribution\u2019 page with new cluster replica information.<\/em><\/li>\n<\/ul>\n<p>Once your replica cluster is set up, here are a few key things to consider:<\/p>\n<ul>\n<li><strong>Network configuration<\/strong>: If the replica cluster will support read operations, adjust <a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/mongodb\/vcore\/security#network-security-options\">networking settings<\/a> to enable either public or private access.<\/li>\n<li><strong>Global connection string<\/strong>: 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.<a href=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-read-write-connection-string.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-8980\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-read-write-connection-string.png\" alt=\"Screenshot of MongoDB vCore global read-write connection string in Azure portal\" width=\"1529\" height=\"771\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-read-write-connection-string.png 1529w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-read-write-connection-string-300x151.png 300w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-read-write-connection-string-1024x516.png 1024w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-read-write-connection-string-768x387.png 768w\" sizes=\"(max-width: 1529px) 100vw, 1529px\" \/><\/a>\n<em>Figure 3. Screenshot from the Azure portal of the \u2018Connection strings\u2019 page with the global read-write connection string.<\/em><\/li>\n<li><strong>Switchover testing<\/strong>: Test your application by promoting the replica cluster to read-write mode, following the steps outlined in the next section.\n<ul>\n<li>Note: You can switch the primary (read-write) and replica (read-only) regions anytime by promoting the replica cluster.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>To promote replica cluster to become available for writes, perform the following steps:<\/p>\n<ol>\n<li>On <em>the replica cluster<\/em> sidebar, under\u00a0<strong>Settings<\/strong>, select\u00a0<strong>Global distribution<\/strong>.<\/li>\n<li>Select <strong>Promote<\/strong> in the toolbar.\nIf you don\u2019t see \u2018Promote\u2019 in the toolbar on the \u2018Global distribution page\u2019, make sure it is the replica cluster and not the primary cluster.<em><a href=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-distribution-promote-replica.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-8978\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-distribution-promote-replica.png\" alt=\"Screenshot of MongoDB vCore global distribution page on a replica cluster in Azure portal with promote button in the toolbar circled\" width=\"1432\" height=\"871\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-distribution-promote-replica.png 1432w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-distribution-promote-replica-300x182.png 300w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-distribution-promote-replica-1024x623.png 1024w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-distribution-promote-replica-768x467.png 768w\" sizes=\"(max-width: 1432px) 100vw, 1432px\" \/><\/a>\nFigure 4. Screenshot from the Azure portal of the replica cluster\u2019s \u2018Global distribution\u2019 page.<\/em><\/li>\n<li>Select <strong>Promote<\/strong> in the \u2018Promote cluster\u2019 window.\nReplica cluster continues to be available for reads while writes are being enabled.<em><a href=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-distribution-replica-promote-confirmation.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-8979\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-distribution-replica-promote-confirmation.png\" alt=\"Screenshot of MongoDB vCore replica promote confirmation window in Azure portal\" width=\"1537\" height=\"871\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-distribution-replica-promote-confirmation.png 1537w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-distribution-replica-promote-confirmation-300x170.png 300w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-distribution-replica-promote-confirmation-1024x580.png 1024w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2024\/11\/mongodb-vcore-global-distribution-replica-promote-confirmation-768x435.png 768w\" sizes=\"(max-width: 1537px) 100vw, 1537px\" \/><\/a>\nFigure 5. Screenshot from the Azure portal of the replica cluster\u2019s promotion confirmation window.<\/em><\/li>\n<\/ol>\n<h1>A key component of your disaster recovery strategy<\/h1>\n<p>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.<\/p>\n<p>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 <a href=\"https:\/\/www.youtube.com\/watch?v=X-4-2G3ZOv8&amp;list=PLmamF3YkHLoKMzT3gP4oqHiJbjMaiiLEh&amp;index=4&amp;t=59s\">handling hundreds of terabytes<\/a>, additional physical shards can be deployed for further scalability in a <a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/mongodb\/vcore\/partitioning\">sharded MongoDB database<\/a>.<\/p>\n<p>Azure Cosmos DB for MongoDB (vCore)\u2019s 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.<\/p>\n<h1>Next steps: Cross-region DR and read scalability in Azure Cosmos DB for MongoDB (vCore)<\/h1>\n<p>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.<\/p>\n<ul>\n<li>Check out <a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/mongodb\/vcore\/cross-region-replication\">details about how cross-region replication works<\/a><\/li>\n<li>Follow <a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/mongodb\/vcore\/how-to-cluster-replica\">these steps<\/a> to enable cross-region replication on your next Azure Cosmos DB for MongoDB (vCore) cluster<\/li>\n<\/ul>\n<h1>Leave a review<\/h1>\n<p>Tell us about your Azure Cosmos DB experience! Leave a review on PeerSpot and we\u2019ll gift you $50. <a href=\"https:\/\/peerspotdotcom.my.site.com\/proReviews\/?SalesOpportunityProduct=00kPy000004TKXJIA4&amp;productPeerspotNumber=30881&amp;CalendlyAccount=peerspot&amp;CalendlyFormLink=peerspot-product-reviews-ps-gc-vi-sf-50&amp;giftCard=50\">Get started here<\/a>.<\/p>\n<h1>About Azure Cosmos DB<\/h1>\n<p>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.<\/p>\n<p><a href=\"https:\/\/cosmos.azure.com\/try\/\">Try Azure Cosmos DB for free here<\/a>. To stay in the loop on Azure Cosmos DB updates, follow us on <a href=\"https:\/\/twitter.com\/AzureCosmosDB\">X<\/a>, <a href=\"https:\/\/aka.ms\/AzureCosmosDBYouTube\">YouTube<\/a>, and <a href=\"https:\/\/www.linkedin.com\/company\/azure-cosmos-db\/\">LinkedIn<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In today&#8217;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 [&hellip;]<\/p>\n","protected":false},"author":103349,"featured_media":8982,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[12,15],"tags":[],"class_list":["post-8975","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-announcements","category-mongodb-api"],"acf":[],"blog_post_summary":"<p>In today&#8217;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 [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/8975","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/users\/103349"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/comments?post=8975"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/8975\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media\/8982"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media?parent=8975"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/categories?post=8975"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/tags?post=8975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}