我正在尝试部署一个新的Azure Cosmos DB for Mongo DB帐户,其中有两个集合,其中一个具有自动缩放吞吐量,而另一个具有手动吞吐量。我通过powershell脚本和New-AzResourceGroupDeployment
命令部署ARM模板。但是,这会失败,并出现错误:
Status Message: Message: {"code":"BadRequest","message":"Message:
{\"Errors\":[\"x-ms-cosmos-migrate-offer-to-manual-throughput must be supplied and offercontent
must contain autopilotSettings for migration of autoscale collection to manual throughput.\"]}
字符串
奇怪的是,Cosmos DB资源实际上完全按照我定义的所有设置部署。在ARM模板中,我没有尝试迁移到手动吞吐量。
这是cosmos数据库的ARM模板
{
"type": "Microsoft.DocumentDB/databaseAccounts",
"apiVersion": "2023-04-15",
"name": "[variables('provisionedCosmosAccountName')]",
"location": "[resourceGroup().location]",
"kind": "MongoDB",
"properties": {
"databaseAccountOfferType": "Standard",
"minimalTlsVersion": "Tls12",
"consistencyPolicy": {
"defaultConsistencyLevel": "Session",
"maxIntervalInSeconds": 5,
"maxStalenessPrefix": 100
},
"apiProperties": {
"serverVersion": "4.2"
},
"locations": [
{
"locationName": "[resourceGroup().location]",
"failoverPriority": 0,
"isZoneRedundant": false
}
],
"capabilities": [
{
"name": "EnableMongo"
},
{
"name": "DisableRateLimitingResponses"
}
],
"backupPolicy": {
"type": "Periodic",
"periodicModeProperties": {
"backupIntervalInMinutes": 240,
"backupRetentionIntervalInHours": 8,
"backupStorageRedundancy": "Geo"
}
},
"capacity": {
"totalThroughputLimit": 7000
}
}
},
{
"type": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases",
"apiVersion": "2023-04-15",
"name": "[format('{0}/{1}', variables('provisionedCosmosAccountName'), variables('cosmosDatabaseName'))]",
"dependsOn": [
"[resourceId('Microsoft.DocumentDB/databaseAccounts', variables('provisionedCosmosAccountName'))]"
],
"properties": {
"resource": {
"id": "[variables('cosmosDatabaseName')]"
}
}
},
{
"type": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections",
"apiVersion": "2023-04-15",
"name": "[format('{0}/{1}/{2}', variables('provisionedCosmosAccountName'), variables('cosmosDatabaseName'), 'Audits')]",
"dependsOn": [
"[resourceId('Microsoft.DocumentDB/databaseAccounts/mongodbDatabases', variables('provisionedCosmosAccountName'), variables('cosmosDatabaseName'))]",
"[resourceId('Microsoft.DocumentDB/databaseAccounts', variables('provisionedCosmosAccountName'))]"
],
"properties": {
"resource": {
"id": "Audits",
"shardKey": {
"PartitionKey": "Hash"
},
"indexes": [
{
"key": {
"keys": [
"_id"
]
}
},
{
"key": {
"keys": [
"PartitionKey"
]
}
}
]
}
}
},
{
"type": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections",
"apiVersion": "2023-04-15",
"name": "[format('{0}/{1}/{2}', variables('provisionedCosmosAccountName'), variables('cosmosDatabaseName'), 'Event')]",
"dependsOn": [
"[resourceId('Microsoft.DocumentDB/databaseAccounts/mongodbDatabases', variables('provisionedCosmosAccountName'), variables('cosmosDatabaseName'))]",
"[resourceId('Microsoft.DocumentDB/databaseAccounts', variables('provisionedCosmosAccountName'))]"
],
"properties": {
"resource": {
"id": "Event",
"shardKey": {
"PartitionKey": "Hash"
},
"indexes": [
{
"key": {
"keys": [
"_id"
]
}
},
{
"key": {
"keys": [
"PartitionKey",
"RunId"
]
},
"options": {
"unique": true
}
},
{
"key": {
"keys": [
"PartitionKey"
]
}
},
{
"key": {
"keys": [
"ChainId"
]
}
},
{
"key": {
"keys": [
"ActionCount"
]
}
},
{
"key": {
"keys": [
"EventId"
]
}
},
{
"key": {
"keys": [
"RunId"
]
}
}
]
},
"options": {
"autoscaleSettings": {
"maxThroughput": 2000
}
}
}
},
{
"type": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/throughputSettings",
"apiVersion": "2023-04-15",
"name": "[format('{0}/{1}/{2}', variables('provisionedCosmosAccountName'), variables('cosmosDatabaseName'), 'Audits/default')]",
"dependsOn": [
"[resourceId('Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections', variables('provisionedCosmosAccountName'), variables('cosmosDatabaseName'), 'Audits')]",
"[resourceId('Microsoft.DocumentDB/databaseAccounts/mongodbDatabases', variables('provisionedCosmosAccountName'), variables('cosmosDatabaseName'))]",
"[resourceId('Microsoft.DocumentDB/databaseAccounts', variables('provisionedCosmosAccountName'))]"
],
"properties": {
"resource": {
"throughput": 500
}
}
},
{
"type": "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/throughputSettings",
"apiVersion": "2023-04-15",
"name": "[format('{0}/{1}/{2}', variables('provisionedCosmosAccountName'), variables('cosmosDatabaseName'), 'Event/default')]",
"dependsOn": [
"[resourceId('Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections', variables('provisionedCosmosAccountName'), variables('cosmosDatabaseName'), 'Event')]",
"[resourceId('Microsoft.DocumentDB/databaseAccounts/mongodbDatabases', variables('provisionedCosmosAccountName'), variables('cosmosDatabaseName'))]",
"[resourceId('Microsoft.DocumentDB/databaseAccounts', variables('provisionedCosmosAccountName'))]"
],
"properties": {
"resource": {
"throughput": 200,
"autoscaleSettings": {
"maxThroughput": 2000
}
}
}
},
型
到目前为止,我已经尝试过用
"options": {
"autoscaleSettings": {
"maxThroughput": 7000
}
}
型
我还将databaseAccounts
资源中的capacity
和totalThroughputLimit
设置替换为
"options": {
"autoscaleSettings": {
"maxThroughput": 7000
}
}
型
有什么想法吗?谢谢你的帮助!
1条答案
按热度按时间bksxznpy1#
你不能用这种方式部署新的资源。集合的选项中定义了一个集合的吞吐量资源和两个其他吞吐量资源的组合。只能在选项中定义具有吞吐量的新集合。您还定义了标准吞吐量和自动缩放吞吐量,这会生成吞吐量迁移错误。
这是更正后的ARM模板。
字符串