微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

将 cosmosdb 从手动切换到自动缩放

如何解决将 cosmosdb 从手动切换到自动缩放

是否可以使用 ARM 模板将 cosmosdb 容器从手动切换到自动缩放?

我正在尝试通过跟随 arm 来实现这一点,但我仍然将 TU 设置设置为手动

{
  "name": "db/collection/container/default","type": "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/throughputSettings","apiVersion": "2020-03-01","properties": {
    "resource": {
      "throughput": "4000","autoscaleSettings": {
        "maxThroughput": "800000"
      }
    }
  },

解决方法

无法执行此操作,因为此调用是对 Cosmos DB 资源提供程序的 POST。

从标准吞吐量迁移到自动缩放吞吐量的唯一方法是使用 Azure 门户、PowerShell 或 Azure CLI。然后,您可以修改您的 ARM 模板并通过在资源选项中使用适当的吞吐量 json 重新部署模板来更新吞吐量量。

这是从标准到自动缩放的容器的 PS 示例。

Invoke-AzCosmosDBSqlContainerThroughputMigration `
   -ResourceGroupName $resourceGroupName `
   -AccountName $accountName `
   -DatabaseName $databaseName `
   -Name $containerName `
   -ThroughputType Autoscale

更多PowerShell examples

这是一个容器从标准到自动缩放的 cli 示例

az cosmosdb sql container throughput migrate \
-a $accountName \
-g $resourceGroupName \
-d $databaseName \
-n $containerName \
-t 'autoscale'

更多CLI examples

如果对其他数据库 API 执行此操作,请在文档中找到 PS 或 CLI 示例。有适用于所有数据库 API 的示例。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。