我正在撰寫一個 powershell 腳本來檢查 cosmosdb 中是否啟用了自動縮放,如果沒有,那么它應該啟用自動縮放。我找不到讓我們檢查是否啟用自動縮放的 powershell 腳本或命令。我指的是以下檔案,它只有一個啟用自動縮放的命令。
https://docs.microsoft.com/en-us/azure/cosmos-db/scripts/powershell/sql/throughput?toc=/powershell/module/toc.json
uj5u.com熱心網友回復:
您可以通過檢查Cmdlet 回傳AutoscaleSettings的物件來檢查容器上是否啟用了自動縮放。$througput如果容器的吞吐量設定為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"
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/490728.html
