You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Configure multi-region writes in your applications that use Azure Cosmos DB
15
15
[!INCLUDE[NoSQL](../includes/appliesto-nosql.md)]
16
16
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.
18
18
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).
21
23
22
24
## <aid="portal"></a> Azure portal
23
25
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:
25
29
26
30
1. Sign-in to the [Azure portal](https://portal.azure.com/).
27
31
28
32
1. Navigate to your Azure Cosmos DB account and from the menu, open the **Replicate data globally** pane.
29
33
30
34
1. Under the **Multi-region writes** option, choose **enable**. It automatically adds the existing regions to read and write regions.
31
35
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.
33
37
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.
35
39
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":::
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:
76
80
77
81
# [Async](#tab/api-async)
78
82
79
-
[Java SDK V4](sdk-java-v4.md) (Maven [com.azure::azure-cosmos](https://mvnrepository.com/artifact/com.azure/azure-cosmos)) Async API
0 commit comments