簡體   English   中英

用於檢查 Azure Cosmos 中是否啟用自動縮放的 PowerShell 腳本

[英]PowerShell script to check if autoscale is enabled in Azure Cosmos

我正在編寫一個 powershell 腳本來檢查 cosmosdb 中是否啟用了自動縮放,如果沒有,那么它應該啟用自動縮放。 我找不到讓我們檢查是否啟用自動縮放的 powershell 腳本或命令。 我指的是以下文檔,它只有一個啟用自動縮放的命令。

https://docs.microsoft.com/en-us/azure/cosmos-db/scripts/powershell/sql/throughput?toc=%2Fpowershell%2Fmodule%2Ftoc.json

您可以通過檢查 Cmdlet 返回的$througput對象的AutoscaleSettings來檢查容器上是否啟用了自動縮放。 如果容器將吞吐量設置為Manual ,則自動縮放設置的MaxThrougput屬性將返回零。

$account = "account-name"
$resourceGroup = "resource-group-name"
$database = "database-name"
$container = "container-name"

$throughput = Get-AzCosmosDBSqlContainerThroughput -ResourceGroupName $resourceGroup `
    -AccountName $account -DatabaseName $database -Name $container

$autoscaleSettings = $throughput.AutoscaleSettings

if ($autoscaleSettings.MaxThroughput -eq 0) {
  Write-Host "Autoscaling is not set on the container"
} else {
  Write-Host "Autoscaling is set on the container"
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM