【问题标题】:Get Cosmodb container throughput with powershell Get-AzCosmosDBSqlContainerthroughput使用 powershell Get-AzCosmosDBAcCount 吞吐量获取 Cosmos Db 容器吞吐量
【发布时间】:2020-04-06 00:03:49
【问题描述】:

它没有给出正确的预置吞吐量值,它是 500,但显示为“0”

PS C:\windows\system32> Get-AzCosmosDBSqlContainerThroughput -ResourceGroupName $resourceGroupName -AccountName $accountName -DatabaseName $databaseName -Name $containerName | select throughput

Throughput
----------
         0

完整输出:

PS C:\windows\system32> $container = Get-AzCosmosDBSqlContainerthroughput `
        -ResourceGroupName $resourceGroupName `
        -AccountName $accountName -DatabaseName $databaseName `
        -Name $containerName

PS C:\windows\system32> $container 


Name                : ECvc
Id                  : /subscriptions/dxxxxx/resourceGroups/RG-01/providers/Microsoft.DocumentDB/databaseAccounts/xxxxx
                      01/sqlDatabases/xxxx/containers/cosmosscaleupordowntest/throughputSettings/default
Throughput          : 0
MinimumThroughput   : 
OfferReplacePending : 

参考: https://docs.microsoft.com/en-us/powershell/module/az.cosmosdb/get-azcosmosdbsqlcontainerthroughput?view=azps-3.7.0

【问题讨论】:

  • 欢迎来到 Stack Overflow!目前还不清楚你在问什么。请查看stackoverflow.com/help/how-to-ask。
  • @stephenwade - 哪一部分不清楚? OP 希望使用 PowerShell 通过 Azure cmdlet 检索 Cosmos DB 容器的当前吞吐量设置,并看到返回的意外值。也许格式可以改进(我刚刚处理过)?

标签: azure azure-cosmosdb azure-powershell


【解决方案1】:

您的脚本是正确的,我无法重现此 cmdlet 返回零。这也不是共享数据库吞吐量的方案,因为此 cmdlet 旨在在未对资源设置吞吐量时引发异常。我唯一的建议是尝试这个模块的最新版本,Az.CosmosDB 0.1.3。我们刚刚在 5 天前更新了它。它可能有一个错误修复。

如果此问题仍然存在,请在PowerShell Issues List 上提出问题。这将被发送给处理这些 cmdlet 的工程师。

谢谢。

【讨论】:

    【解决方案2】:

    我没有使用 (az) Powershell 脚本,但我能够使用 powershell 读取和更新 Cosmos DB RU。

    $databasePrimaryKey = "************"
    $cosmosDbAccountName = "************"
    $databaseName = "************"
    $primaryKey = ConvertTo-SecureString -String $databasePrimaryKey -AsPlainText –Force
    

    获取所有容器的列表并配置RU(集合名称不会显示)

    Get-CosmosDbOffer -Context $cosmosDbContext
    

    更新欲望RU

    Get-CosmosDbOffer -Context $cosmosDbContext -Id $collectionId |
        Set-CosmosDbOffer -Context $cosmosDbContext -OfferThroughput 400 - 
    

    OfferIsRUPerMinuteThroughputEnabled $true

    希望对你有帮助

    【讨论】:

    • 谢谢Pankaj,但我没有cosmosdoffer cmdlet,所以我尝试安装最新的失败,安装它有什么不同吗?
    • PS C:\windows\system32> Install-Module -Name CosmosDB 警告:源位置“powershellgallery.com/api/v2/package/CosmosDB/3.7.0”无效。 PackageManagement\Install-Package : 包“CosmosDB”下载失败。
    • 按顺序使用以下命令 1) Install-Module -Name AzureRM.profile 2) Install-Module -Name AzureRM.Resources 3) Install-Module -Name CosmosDB
    • AzureRM 已被弃用。您不应该建议人们使用它。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-06
    • 1970-01-01
    • 2016-11-08
    • 2020-04-10
    • 2013-03-23
    相关资源
    最近更新 更多