Skip to content

Commit 91e8eec

Browse files
committed
First draft
1 parent 9723b09 commit 91e8eec

File tree

1 file changed

+112
-67
lines changed

1 file changed

+112
-67
lines changed

articles/cosmos-db/merge.md

Lines changed: 112 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
---
2-
title: Merge partitions in Azure Cosmos DB (preview)
3-
description: Learn more about the merge partitions capability in Azure Cosmos DB
2+
title: Merge partitions (preview)
3+
titleSuffix: Azure Cosmos DB
4+
description: Reduce the number of physical partitions used for your container with the merge capability in Azure Cosmos DB.
5+
ms.topic: conceptual
46
author: seesharprun
57
ms.author: sidandrews
8+
ms.reviewer: dech
69
ms.service: cosmos-db
10+
ms.date: 02/07/2023
711
ms.custom: event-tier1-build-2022, ignite-2022
8-
ms.topic: conceptual
9-
ms.reviewer: dech
10-
ms.date: 10/26/2022
1112
---
1213

1314
# Merge partitions in Azure Cosmos DB (preview)
@@ -70,69 +71,111 @@ Based on conditions 1 and 2, our container can potentially benefit from merging
7071
### Merging physical partitions
7172

7273
In PowerShell, when the flag `-WhatIf` is passed in, Azure Cosmos DB will run a simulation and return the expected result of the merge, but won't run the merge itself. When the flag isn't passed in, the merge will execute against the resource. When finished, the command will output the current amount of storage in KB per physical partition post-merge.
74+
7375
> [!TIP]
7476
> Before running a merge, it's recommended to set your provisioned RU/s (either manual RU/s or autoscale max RU/s) as close as possible to your desired steady state RU/s post-merge, to help ensure the system calculates an efficient partition layout.
7577
7678
#### [PowerShell](#tab/azure-powershell)
7779

78-
```azurepowershell
79-
// Add the preview extension
80-
$parameters = @{
81-
Name = "Az.CosmosDB"
82-
AllowPrerelease = $true
83-
Force = $true
84-
}
85-
Install-Module @parameters
86-
```
87-
88-
```azurepowershell
89-
// API for NoSQL
90-
$parameters = @{
91-
ResourceGroupName = "<resource-group-name>"
92-
AccountName = "<cosmos-account-name>"
93-
DatabaseName = "<cosmos-database-name>"
94-
Name = "<cosmos-container-name>"
95-
WhatIf = $true
96-
}
97-
Invoke-AzCosmosDBSqlContainerMerge @parameters
98-
```
99-
100-
```azurepowershell
101-
// API for MongoDB
102-
$parameters = @{
103-
ResourceGroupName = "<resource-group-name>"
104-
AccountName = "<cosmos-account-name>"
105-
DatabaseName = "<cosmos-database-name>"
106-
Name = "<cosmos-container-name>"
107-
WhatIf = $true
108-
}
109-
Invoke-AzCosmosDBMongoDBCollectionMerge @parameters
110-
```
80+
1. First, use [`Install-Module`](/powershell/module/powershellget/install-module) to install the [Az.CosmosDB](/powershell/module/az.cosmosdb/) module with pre-release features enabled.
81+
82+
```azurepowershell-interactive
83+
$parameters = @{
84+
Name = "Az.CosmosDB"
85+
AllowPrerelease = $true
86+
Force = $true
87+
}
88+
Install-Module @parameters
89+
```
90+
91+
##### [API for NoSQL](#tab/azure-powershell/nosql)
92+
93+
1. Next, use `Invoke-AzCosmosDBSqlContainerMerge` with the `-WhatIf` parameter to preview the merge without actually performing the operation.
94+
95+
```azurepowershell-interactive
96+
$parameters = @{
97+
ResourceGroupName = "<resource-group-name>"
98+
AccountName = "<cosmos-account-name>"
99+
DatabaseName = "<cosmos-database-name>"
100+
Name = "<cosmos-container-name>"
101+
WhatIf = $true
102+
}
103+
Invoke-AzCosmosDBSqlContainerMerge @parameters
104+
```
105+
106+
1. Finally, start the merge by running the same command without the `-WhatIf` parameter.
107+
108+
```azurepowershell-interactive
109+
$parameters = @{
110+
ResourceGroupName = "<resource-group-name>"
111+
AccountName = "<cosmos-account-name>"
112+
DatabaseName = "<cosmos-database-name>"
113+
Name = "<cosmos-container-name>"
114+
}
115+
Invoke-AzCosmosDBSqlContainerMerge @parameters
116+
```
117+
118+
##### [API for MongoDB](#tab/azure-powershell/mongodb)
119+
120+
1. Next, use `Invoke-AzCosmosDBMongoDBCollectionMerge` with the `-WhatIf` parameter to preview the merge without actually performing the operation.
121+
122+
```azurepowershell-interactive
123+
$parameters = @{
124+
ResourceGroupName = "<resource-group-name>"
125+
AccountName = "<cosmos-account-name>"
126+
DatabaseName = "<cosmos-database-name>"
127+
Name = "<cosmos-container-name>"
128+
WhatIf = $true
129+
}
130+
Invoke-AzCosmosDBMongoDBCollectionMerge @parameters
131+
```
132+
133+
1. Finally, start the merge by running the same command without the `-WhatIf` parameter.
134+
135+
```azurepowershell-interactive
136+
$parameters = @{
137+
ResourceGroupName = "<resource-group-name>"
138+
AccountName = "<cosmos-account-name>"
139+
DatabaseName = "<cosmos-database-name>"
140+
Name = "<cosmos-container-name>"
141+
}
142+
Invoke-AzCosmosDBMongoDBCollectionMerge @parameters
143+
```
144+
145+
---
111146
112147
#### [Azure CLI](#tab/azure-cli)
113148
114-
```azurecli
115-
// Add the preview extension
116-
az extension add --name cosmosdb-preview
117-
```
118-
119-
```azurecli
120-
// API for NoSQL
121-
az cosmosdb sql container merge \
122-
--resource-group '<resource-group-name>' \
123-
--account-name '<cosmos-account-name>' \
124-
--database-name '<cosmos-database-name>' \
125-
--name '<cosmos-container-name>'
126-
```
127-
128-
```azurecli
129-
// API for MongoDB
130-
az cosmosdb mongodb collection merge \
131-
--resource-group '<resource-group-name>' \
132-
--account-name '<cosmos-account-name>' \
133-
--database-name '<cosmos-database-name>' \
134-
--name '<cosmos-collection-name>'
135-
```
149+
1. First, use [`az extension add`](/cli/azure/extension#az-extension-add) to install the [cosmosdb-preview](https://github.com/azure/azure-cli-extensions/tree/main/src/cosmosdb-preview) Azure CLI extension.
150+
151+
```azurecli-interactive
152+
az extension add \
153+
--name cosmosdb-preview
154+
```
155+
156+
##### [API for NoSQL](#tab/azure-cli/nosql)
157+
158+
1. Now, start the merge by using [`az cosmosdb sql container merge`](/cli/azure/cosmosdb/sql/container#az-cosmosdb-sql-container-merge).
159+
160+
```azurecli-interactive
161+
az cosmosdb sql container merge \
162+
--resource-group '<resource-group-name>' \
163+
--account-name '<cosmos-account-name>' \
164+
--database-name '<cosmos-database-name>' \
165+
--name '<cosmos-container-name>'
166+
```
167+
168+
##### [API for MongoDB](#tab/azure-cli/mongodb)
169+
170+
1. Now, start the merge by using [`az cosmosdb mongodb collection merge`](/cli/azure/cosmosdb/mongodb/collection#az-cosmosdb-mongodb-collection-merge).
171+
172+
```azurecli-interactive
173+
az cosmosdb mongodb collection merge \
174+
--resource-group '<resource-group-name>' \
175+
--account-name '<cosmos-account-name>' \
176+
--database-name '<cosmos-database-name>' \
177+
--name '<cosmos-collection-name>'
178+
```
136179
137180
---
138181
@@ -146,6 +189,8 @@ You can track whether merge is still in progress by checking the **Activity Log*
146189
147190
## Limitations
148191
192+
The following are limitations of the merge feature at this time.
193+
149194
### Preview eligibility criteria
150195
151196
To enroll in the preview, your Azure Cosmos DB account must meet all the following criteria:
@@ -202,15 +247,15 @@ Support for other SDKs is planned for the future.
202247
203248
If you enroll in the preview, the following connectors will fail.
204249
205-
- Azure Data Factory <sup>1</sup>
206-
- Azure Stream Analytics <sup>1</sup>
207-
- Logic Apps <sup>1</sup>
208-
- Azure Functions <sup>1</sup>
209-
- Azure Search <sup>1</sup>
210-
- Azure Cosmos DB Spark connector <sup>1</sup>
250+
- Azure Data Factory ¹
251+
- Azure Stream Analytics ¹
252+
- Logic Apps ¹
253+
- Azure Functions ¹
254+
- Azure Search ¹
255+
- Azure Cosmos DB Spark connector ¹
211256
- Any third party library or tool that has a dependency on an Azure Cosmos DB SDK that isn't .NET V3 SDK v3.27.0 or higher
212257
213-
<sup>1</sup> Support for these connectors is planned for the future.
258+
¹ Support for these connectors is planned for the future.
214259
215260
## Next steps
216261

0 commit comments

Comments
 (0)