Skip to content

Commit 94e4d12

Browse files
authored
Merge pull request #277834 from anaharris-ms/reloc-cosmosdb
Relocation: Cosmos DB
2 parents 9f7f2c3 + eec40c7 commit 94e4d12

File tree

7 files changed

+124
-89
lines changed

7 files changed

+124
-89
lines changed

.openpublishing.redirection.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4195,6 +4195,12 @@
41954195
},
41964196
{
41974197

4198+
"source_path_from_root": "/articles/cosmos-db/how-to-move-regions.md",
4199+
"redirect_url": "/azure/operational-excellence/relocation-cosmos-db",
4200+
"redirect_document_id": false
4201+
4202+
},
4203+
{
41984204
"source_path_from_root": "/articles/site-recovery/move-vaults-across-regions.md",
41994205
"redirect_url": "/azure/operational-excellence/relocation-site-recovery",
42004206
"redirect_document_id": false

articles/cosmos-db/how-to-move-regions.md

Lines changed: 0 additions & 85 deletions
This file was deleted.

articles/cosmos-db/nosql/TOC.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,8 +769,8 @@
769769
- name: Using Terraform
770770
href: manage-with-terraform.md
771771
displayName: Terraform
772-
- name: Move between regions
773-
href: ../how-to-move-regions.md
772+
- name: Relocate to another region
773+
href: ../../operational-excellence/relocation-cosmos-db.md?toc=/azure/cosmosdb/nosql/toc.json
774774
- name: Prevent changes or deletion
775775
href: ../resource-locks.md
776776
- name: Global distribution

articles/operational-excellence/TOC.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
- name: Azure Container Registry
4848
href: ../container-registry/manual-regional-move.md?toc=/azure/operational-excellence/toc.json
4949
- name: Azure Cosmos DB
50-
href: ../cosmos-db/how-to-move-regions.md?toc=/azure/operational-excellence/toc.json
50+
href: relocation-cosmos-db.md
5151
- name: Azure Database for MariaDB Server
5252
href: ../mariadb/howto-move-regions-portal.md?toc=/azure/operational-excellence/toc.json
5353
- name: Azure Database for MySQL Server
96.5 KB
Loading

articles/operational-excellence/overview-relocation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ The following tables provide links to each Azure service relocation document. Th
6161
[Azure Batch](../batch/account-move.md?toc=/azure/operational-excellence/toc.json)|✅ | ✅| ❌ |
6262
[Azure Cache for Redis](../azure-cache-for-redis/cache-moving-resources.md?toc=/azure/operational-excellence/toc.json)| ✅ | ❌| ❌ |
6363
[Azure Container Registry](../container-registry/manual-regional-move.md)|✅ | ✅| ❌ |
64-
[Azure Cosmos DB](../cosmos-db/how-to-move-regions.md?toc=/azure/operational-excellence/toc.json)|✅ | ✅| ❌ |
64+
[Azure Cosmos DB](relocation-cosmos-db.md)|✅ | ✅| ❌ |
6565
[Azure Database for MariaDB Server](../mariadb/howto-move-regions-portal.md?toc=/azure/operational-excellence/toc.json)|✅ | ✅| ❌ |
6666
[Azure Database for MySQL Server](../mysql/howto-move-regions-portal.md?toc=/azure/operational-excellence/toc.json)✅ | ✅| ❌ |
6767
[Azure Database for PostgreSQL](./relocation-postgresql-flexible-server.md)| ✅ | ✅| ❌ |
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
---
2+
title: Relocate an Azure Cosmos DB NoSQL account to another region
3+
description: Learn how to relocate an Azure Cosmos DB NoSQL account to another region.
4+
author: seesharprun
5+
ms.service: cosmos-db
6+
ms.subservice: nosql
7+
ms.topic: how-to
8+
ms.custom:
9+
- subject-relocation
10+
ms.date: 06/11/2024
11+
ms.author: sidandrews
12+
ms.reviewer: mjbrown
13+
---
14+
15+
# Relocate an Azure Cosmos DB NoSQL account to another region
16+
17+
18+
This article describes how to either:
19+
20+
- Relocate a region where data is replicated in Azure Cosmos DB.
21+
- Migrate account (Azure Resource Manager) metadata and data from one region to another.
22+
23+
24+
## Prerequisites
25+
26+
- An app registration must be created with delegated permission to the source and target resource group instance and “API permission” for “User.ReadBasic.All”.
27+
28+
- The selected Cosmos DB API must remain same from source to target. This document uses SQL DB API.
29+
30+
- Account names must be limited to 44 characters, all lowercase.
31+
32+
- When you add or remove locations to an Azure Cosmos account, you can’t simultaneously modify other properties.
33+
34+
- Identify all Cosmos DB dependent resources.
35+
36+
37+
## Downtime
38+
39+
## Considerations for Service Endpoints
40+
41+
The virtual network service endpoints for Azure Cosmos DB restrict access to a specified virtual network. The endpoints can also restrict access to a list of IPv4 (internet protocol version 4) address ranges. Any user connecting to the Event Hubs from outside those sources is denied access. If Service endpoints were configured in the source region for the Event Hubs resource, the same would need to be done in the target one.
42+
43+
For a successful recreation of the Azure Cosmos DB to the target region, the VNet and Subnet must be created beforehand. In case the move of these two resources is being carried out with the Azure Resource Mover tool, the service endpoints won’t be configured automatically. Hence, they need to be configured manually, which can be done through the [Azure portal](/azure/key-vault/general/quick-create-portal), the [Azure CLI](/azure/key-vault/general/quick-create-cli), or [Azure PowerShell](/azure/key-vault/general/quick-create-powershell).
44+
45+
46+
47+
## Redeploy without data
48+
49+
For cases where the Cosmos DB instance needs to be relocated alone without the configuration and customer data, the instance itself can be created using [Microsoft.DocumentDB databaseAccounts](/azure/templates/microsoft.documentdb/2021-04-15/databaseaccounts?tabs=json&pivots=deployment-language-arm-template)
50+
51+
## Redeploy with data
52+
53+
Azure Cosmos DB supports data replication natively, so moving data from one region to another is simple. You can accomplish it by using the Azure portal, Azure PowerShell, or the Azure CLI. It involves the following steps:
54+
55+
1. Add a new region to the account.
56+
57+
To add a new region to an Azure Cosmos DB account, see [Add/remove regions to an Azure Cosmos DB account](../cosmos-db/how-to-manage-database-account.yml#add-remove-regions-from-your-database-account).
58+
59+
1. Perform a manual failover to the new region.
60+
61+
When the region that's being removed is currently the write region for the account, you'll need to start a failover to the new region added in the previous step. This is a zero-downtime operation. If you're moving a read region in a multiple-region account, you can skip this step.
62+
63+
To start a failover, see [Perform manual failover on an Azure Cosmos DB account](../cosmos-db/how-to-manage-database-account.yml#perform-manual-failover-on-an-azure-cosmos-db-account).
64+
65+
1. Remove the original region.
66+
67+
To remove a region from an Azure Cosmos DB account, see [Add/remove regions from your Azure Cosmos DB account](../cosmos-db/how-to-manage-database-account.yml#add-remove-regions-from-your-database-account).
68+
69+
> [!NOTE]
70+
> If you perform a failover operation or add/remove a new region while an [asynchronous throughput scaling operation](../cosmos-db/scaling-provisioned-throughput-best-practices.md#background-on-scaling-rus) is in progress, the throughput scale-up operation will be paused. It will resume automatically when the failover or add/remove region operation is complete.
71+
72+
## Redeploy Azure Cosmos DB account metadata
73+
74+
Azure Cosmos DB does not natively support migrating account metadata from one region to another. To migrate both the account metadata and customer data from one region to another, you must create a new account in the desired region and then copy the data manually.
75+
76+
> [!IMPORTANT]
77+
> It is not necessary to migrate the account metadata if the data is stored or moved to a different region. The region in which the account metadata resides has no impact on the performance, security or any other operational aspects of your Azure Cosmos DB account.
78+
79+
A near-zero-downtime migration for the API for NoSQL requires the use of the [change feed](../cosmos-db/change-feed.md) or a tool that uses it.
80+
81+
The following steps demonstrate how to migrate an Azure Cosmos DB account for the API for NoSQL and its data from one region to another:
82+
83+
1. Create a new Azure Cosmos DB account in the desired region.
84+
85+
To create a new account via the Azure portal, PowerShell, or the Azure CLI, see [Create an Azure Cosmos DB account](../cosmos-db/how-to-manage-database-account.yml#create-an-account).
86+
87+
1. Create a new database and container.
88+
89+
To create a new database and container, see [Create an Azure Cosmos DB container](../cosmos-db/nosql/how-to-create-container.md).
90+
91+
1. Migrate data by using the Azure Cosmos DB Spark Connector live migration sample.
92+
93+
To migrate data with near zero downtime, see [Live Migrate Azure Cosmos DB SQL API Containers data with Spark Connector](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/cosmos/azure-cosmos-spark_3_2-12/Samples/DatabricksLiveContainerMigration).
94+
95+
1. Update the application connection string.
96+
97+
With the Live Data Migration sample still running, update the connection information in the new deployment of your application. You can retrieve the endpoints and keys for your application from the Azure portal.
98+
99+
:::image type="content" source="../cosmos-db/media/secure-access-to-data/nosql-database-security-master-key-portal.png" alt-text="Access control in the Azure portal, demonstrating NoSQL database security.":::
100+
101+
1. Redirect requests to the new application.
102+
103+
After the new application is connected to Azure Cosmos DB, you can redirect client requests to your new deployment.
104+
105+
1. Delete any resources that you no longer need.
106+
107+
With requests now fully redirected to the new instance, you can delete the old Azure Cosmos DB account and stop the Live Data Migrator sample.
108+
109+
## Next steps
110+
111+
For more information and examples on how to manage the Azure Cosmos DB account as well as databases and containers, read the following articles:
112+
113+
* [Manage an Azure Cosmos DB account](../cosmos-db/how-to-manage-database-account.yml)
114+
* [Change feed in Azure Cosmos DB](../cosmos-db/change-feed.md)

0 commit comments

Comments
 (0)