使用 Azure CLI 创建新的 Cosmos DB 集合时如何指定 10GB 固定大小

How to specify a 10GB fixed size when creating a new Cosmos DB collection using the Azure CLI

我正在尝试弄清楚如何在使用 Azure CLI 创建新的 Cosmos DB 集合时指定 10GB 的固定大小。 az cosmosdb collection create 命令不允许您指定。一定是在我面前,但我看不出如何实现。

az cosmosdb collection create --collection-name
                          --db-name
                          [--default-ttl]
                          [--indexing-policy]
                          [--key]
                          [--name]
                          [--partition-key-path]
                          [--resource-group-name]
                          [--throughput]
                          [--url-connection]

文档link:https://docs.microsoft.com/en-us/cli/azure/cosmosdb/collection?view=azure-cli-latest#az-cosmosdb-collection-create

默认情况下,当您使用 Azure CLI 时,创建的集合具有 10Gb 的固定存储量。

我运行这个命令

az cosmosdb collection create --collection-name "hither" --db-name "Lightning"  --name "toannsss"--db-name "Lightning" --resource-group-name "rsgroup" --name "toanns" --key "YourKey" --url-connection "https://toanns.documents.azure.com:443/"

创建的

截至 2018 年 7 月 22 日,我认为还没有从 Azure CLI 创建无限大小集合的选项

使用 CLI 时,您可以创建固定 (10GB) 和无限 collection。主要区别在于您是否指定分区键(然后在有效 运行ge 内指定固定或无限 collection 的吞吐量)。 collection 秒需要分区键。

比如我只是运行这两个命令:

az cosmosdb collection create -d Whosebug -c test1
--name <mycosmosaccountname> --key "<mycosmosaccountkey>"
--throughput 400

az cosmosdb collection create -d Whosebug -c test2
--name <mycosmosaccountname> --key "<mycosmosaccountkey>"
--partition-key-path "/foo" --throughput 3000

这创建了 10GB collection 和无限 collection: