添加新集合时对Azure Cosmos DB Emulator的高需求

Nic*_*liu 4 azure azure-cosmosdb azure-cosmosdb-mongoapi

当我尝试将新集合添加到数据库时,我收到此错误:

Failed to create collection 'Products'.

Error:
Sorry, we are currently experiencing high demand in this region, and cannot 
fulfill your request at this time. We work continuously to bring more and 
more capacity online, and encourage you to try again. Please do not hesitate 
to email docdbswat@microsoft.com at any time or for any reason.
ActivityId: bad1a40a-0000-0000-0000-000000000000, 
Microsoft.Azure.Documents.Common/1.22.0.0
Run Code Online (Sandbox Code Playgroud)

这是一个本地模拟器,这个地区有什么样的高级别?

Mat*_*nta 7

根据官方文件.

默认情况下,您可以使用Azure Cosmos DB Emulator创建最多25个单个分区集合或1个分区集合.通过修改PartitionCount值,您可以创建多达250个单个分区集合或10个分区集合,或者两个不超过250个单个分区的组合(其中一个分区集合= 25个单个分区集合).

所以基本上,如果要创建更多分区集合或更多单分区集合,只需PartitionCount从命令行开始增加:

CosmosDB.Emulator.exe /PartitionCount=100
Run Code Online (Sandbox Code Playgroud)

  • 它会消耗更多的环境资源,因为它需要为这些分区分配更多的空间和资源,这就是为什么默认不是250。 (2认同)

Sig*_*gex 5

我团队中的其他人无需CosmosDB.Emulator.exe /PartitionCount=100. 我们可以看到容器没有被创建。

Microsoft 解释了如何解决此问题: https://learn.microsoft.com/en-us/azure/cosmos-db/local-emulator#set-partitioncount

在此输入图像描述

在此输入图像描述

  1. 重置数据
  2. 退出 CosmosDb
  3. 转到%LOCALAPPDATA%\CosmosDBEmulator并删除所有内容
  4. 重新启动机器以获得良好的效果

您现在应该能够重试并且一切都应该有效。