Skip to content

Commit c701d29

Browse files
Merge pull request #230240 from TimShererWithAquent/us2036619i
Freshness Pass User Story: 2036619 Configure multi-region writes in your applications that use Azure Cosmos DB
2 parents 7dc1e6f + 8a423a2 commit c701d29

File tree

1 file changed

+18
-23
lines changed

1 file changed

+18
-23
lines changed

articles/cosmos-db/nosql/how-to-multi-master.md

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: seesharprun
55
ms.service: cosmos-db
66
ms.subservice: nosql
77
ms.topic: how-to
8-
ms.date: 01/06/2021
8+
ms.date: 03/10/2023
99
ms.author: sidandrews
1010
ms.reviewer: mjbrown
1111
ms.custom: devx-track-python, devx-track-js, devx-track-csharp, "seo-nov-2020"
@@ -14,26 +14,30 @@ ms.custom: devx-track-python, devx-track-js, devx-track-csharp, "seo-nov-2020"
1414
# Configure multi-region writes in your applications that use Azure Cosmos DB
1515
[!INCLUDE[NoSQL](../includes/appliesto-nosql.md)]
1616

17-
Once an account has been created with multiple write regions enabled, you must make two changes in your application to the ConnectionPolicy for the Azure Cosmos DB client to enable the multi-region writes in Azure Cosmos DB. Within the ConnectionPolicy, set UseMultipleWriteLocations to true and pass the name of the region where the application is deployed to ApplicationRegion. This will populate the PreferredLocations property based on the geo-proximity from location passed in. If a new region is later added to the account, the application does not have to be updated or redeployed, it will automatically detect the closer region and will auto-home on to it should a regional event occur.
17+
In multiple region write scenarios, you can get a performance benefit by writing only to the region close to your application instance. Azure Cosmos DB handles the replication for you behind the scenes.
1818

19-
> [!Note]
20-
> Azure Cosmos DB accounts initially configured with single write region can be configured to multiple write regions with zero down time. To learn more see, [Configure multiple-write regions](../how-to-manage-database-account.md#configure-multiple-write-regions)
19+
After you enable your account for multiple write regions, you must make two changes in your application to the `ConnectionPolicy`. Within the `ConnectionPolicy`, set `UseMultipleWriteLocations` to `true` and pass the name of the region where the application is deployed to `ApplicationRegion`. This action populates the `PreferredLocations` property based on the geo-proximity from location passed in. If a new region is later added to the account, the application doesn't have to be updated or redeployed. It automatically detects the closer region and auto-homes on to it should a regional event occur.
20+
21+
> [!NOTE]
22+
> Azure Cosmos DB accounts initially configured with single write region can be configured to multiple write regions with zero down time. To learn more see, [Configure multiple-write regions](../how-to-manage-database-account.md#configure-multiple-write-regions).
2123
2224
## <a id="portal"></a> Azure portal
2325

24-
To enable multi-region writes from Azure portal, use the following steps:
26+
To use multi-region writes, enable your Azure Cosmos DB account for multiple regions by using the Azure portal. Specify which regions your application can write to.
27+
28+
To enable multi-region writes, use the following steps:
2529

2630
1. Sign-in to the [Azure portal](https://portal.azure.com/).
2731

2832
1. Navigate to your Azure Cosmos DB account and from the menu, open the **Replicate data globally** pane.
2933

3034
1. Under the **Multi-region writes** option, choose **enable**. It automatically adds the existing regions to read and write regions.
3135

32-
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.
36+
1. You can add more regions by selecting the icons on the map or by selecting the **Add region** button. All the regions you add have both read and writes enabled.
3337

34-
1. After you update the region list, select **save** to apply the changes.
38+
1. After you update the region list, select **Save** to apply the changes.
3539

36-
:::image type="content" source="./media/how-to-multi-master/enable-multi-region-writes.png" alt-text="Screenshot to enable multi-region writes using Azure portal" lightbox="./media/how-to-multi-master/enable-multi-region-writes.png":::
40+
:::image type="content" source="./media/how-to-multi-master/enable-multi-region-writes.png" alt-text="Screenshot to enable multi-region writes using Azure portal." lightbox="./media/how-to-multi-master/enable-multi-region-writes.png":::
3741

3842
## <a id="netv2"></a>.NET SDK v2
3943

@@ -72,21 +76,21 @@ CosmosClient client = cosmosClientBuilder.Build();
7276

7377
## <a id="java4-multi-region-writes"></a> Java V4 SDK
7478

75-
To enable multi-region writes in your application, call `.multipleWriteRegionsEnabled(true)` and `.preferredRegions(preferredRegions)` in the client builder, where `preferredRegions` is a `List` containing one element - that is the region in which the application is being deployed and where Azure Cosmos DB is replicated:
79+
To enable multi-region writes in your application, call `.multipleWriteRegionsEnabled(true)` and `.preferredRegions(preferredRegions)` in the client builder, where `preferredRegions` is a `List` containing one element. That element is the region in which the application is being deployed and where Azure Cosmos DB is replicated:
7680

7781
# [Async](#tab/api-async)
7882

79-
[Java SDK V4](sdk-java-v4.md) (Maven [com.azure::azure-cosmos](https://mvnrepository.com/artifact/com.azure/azure-cosmos)) Async API
83+
[Java SDK V4](sdk-java-v4.md) (Maven [com.azure::azure-cosmos](https://mvnrepository.com/artifact/com.azure/azure-cosmos)) Async API:
8084

8185
[!code-java[](~/azure-cosmos-java-sql-api-samples/src/main/java/com/azure/cosmos/examples/documentationsnippets/async/SampleDocumentationSnippetsAsync.java?name=ConfigureMultimasterAsync)]
8286

8387
# [Sync](#tab/api-sync)
8488

85-
[Java SDK V4](sdk-java-v4.md) (Maven [com.azure::azure-cosmos](https://mvnrepository.com/artifact/com.azure/azure-cosmos)) Sync API
89+
[Java SDK V4](sdk-java-v4.md) (Maven [com.azure::azure-cosmos](https://mvnrepository.com/artifact/com.azure/azure-cosmos)) Sync API:
8690

8791
[!code-java[](~/azure-cosmos-java-sql-api-samples/src/main/java/com/azure/cosmos/examples/documentationsnippets/sync/SampleDocumentationSnippets.java?name=ConfigureMultimasterSync)]
8892

89-
---
93+
---
9094

9195
## <a id="java2-multi-region-writes"></a> Async Java V2 SDK
9296

@@ -137,14 +141,5 @@ client = cosmos_client.CosmosClient(self.account_endpoint, {
137141

138142
## Next steps
139143

140-
Read the following articles:
141-
142-
* [Use session tokens to manage consistency in Azure Cosmos DB](how-to-manage-consistency.md#utilize-session-tokens)
143-
* [Conflict types and resolution policies in Azure Cosmos DB](../conflict-resolution-policies.md)
144-
* [High availability in Azure Cosmos DB](../high-availability.md)
145-
* [Consistency levels in Azure Cosmos DB](../consistency-levels.md)
146-
* [Choose the right consistency level in Azure Cosmos DB](../consistency-levels.md)
147-
* [Consistency, availability, and performance tradeoffs in Azure Cosmos DB](../consistency-levels.md)
148-
* [Availability and performance tradeoffs for various consistency levels](../consistency-levels.md)
149-
* [Globally scaling provisioned throughput](../request-units.md)
150-
* [Global distribution: Under the hood](../global-dist-under-the-hood.md)
144+
- [Use session tokens to manage consistency in Azure Cosmos DB](how-to-manage-consistency.md#utilize-session-tokens)
145+
- [Conflict types and resolution policies in Azure Cosmos DB](../conflict-resolution-policies.md)

0 commit comments

Comments
 (0)