Skip to content

Commit cbe0646

Browse files
Merge pull request #216172 from gahl-levy/mongo-multi-region-write-docs
Mongo multi region write docs
2 parents dfe16a3 + ac3728b commit cbe0646

File tree

4 files changed

+55
-1
lines changed

4 files changed

+55
-1
lines changed

articles/cosmos-db/mongodb/TOC.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,12 +399,14 @@
399399
href: migrate-databricks.md
400400
- name: Post-migration guide
401401
href: post-migration-optimization.md
402-
- name: Manage API for MongoDB resources
402+
- name: Manage Cosmos DB for MongoDB resources
403403
items:
404404
- name: Create a collection
405405
href: how-to-create-container.md
406406
- name: Allocate throughput
407407
href: how-to-provision-throughput.md
408+
- name: Configure multi-region writes
409+
href: how-to-configure-multi-region-write.md
408410
- name: Limit total account throughput
409411
displayName: cost, RUs, RU
410412
href: ../limit-total-account-throughput.md
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
title: Configure multi-region writes in your Azure Cosmos DB for MongoDB database
3+
description: Learn how to configure multi-region writes in Azure Cosmos DB for MongoDB
4+
author: gahl-levy
5+
ms.service: cosmos-db
6+
ms.topic: how-to
7+
ms.date: 10/27/2022
8+
ms.author: gahllevy
9+
---
10+
11+
# Configure multi-region writes in Azure Cosmos DB for MongoDB
12+
[!INCLUDE[MongoDB](../includes/appliesto-mongodb.md)]
13+
14+
Multi-region writes in Azure Cosmos DB for MongoDB enable your clients to write to multiple regions. This results in lower latency and better availability for your writes. It's important to note that unlike other MongoDB services, Azure Cosmos DB for MongoDB enables you to write data from the same shard to multiple regions. Multi-region writes is a true active-active setup.
15+
16+
## Configure in Azure portal
17+
To enable multi-region writes from Azure portal, use the following steps:
18+
19+
1. Sign-in to the [Azure portal](https://portal.azure.com/).
20+
21+
1. Navigate to your Azure Cosmos DB for MongoDB account and from the menu, open the **Replicate data globally** pane.
22+
23+
1. Under the **Multi-region writes** option, choose **enable**. It automatically adds the existing regions to read and write regions.
24+
25+
1. You can add additional regions by selecting the icons on the map or by selecting the **Add region** button. All the regions you add will have both read and writes enabled.
26+
27+
1. After you update the region list, select **save** to apply the changes.
28+
29+
:::image type="content" source="./media/how-to-multi-region-write/enable-multi-region-writes.png" alt-text="Screenshot to enable multi-region writes using Azure portal." lightbox="./media/how-to-multi-region-write/enable-multi-region-writes.png":::
30+
31+
32+
## Connect your client
33+
MongoDB connection strings supports the “appName” parameter, which is a means to identify client workloads. appName is used to identify the preferred write region for your connection. AppName can be specified in the connection string or using SDK specific initialization methods/properties.
34+
35+
The appName parameter can be in one of the following formats​:
36+
37+
```powershell
38+
appName=<user-workload-name>​
39+
appName=<user-workload-name>@<preferred-write-region>​
40+
appName=<user-workload-name>@<cosmosdb-account-name>@<preferred-write-region>
41+
```
42+
43+
On multi-region write accounts, Azure portal supports generation of region-specific connection strings to encode the preferred region list​. Selecting the preferred region dropdown will change the appName in the connection string to set the preferred write region. Simply copy the connection string after setting the preferred region.
44+
45+
:::image type="content" source="./media/how-to-multi-region-write/connect-multi-region-writes.png" alt-text="Screenshot to connect to multi-region writes account using Azure portal." lightbox="./media/how-to-multi-region-write/connect-multi-region-writes.png":::
46+
47+
We recommend applications deployed to different regions to use the region-specific connection string with the correct preferred region for low-latency writes.
48+
49+
## Next steps
50+
51+
- Get an overview of [secure access to data in Azure Cosmos DB](../secure-access-to-data.md).
52+
- Learn more about [RBAC for Azure Cosmos DB management](../role-based-access-control.md).
152 KB
Loading
230 KB
Loading

0 commit comments

Comments
 (0)