[英]PowerShell script to check if autoscale is enabled in Azure Cosmos
我正在編寫一個 powershell 腳本來檢查 cosmosdb 中是否啟用了自動縮放,如果沒有,那么它應該啟用自動縮放。 我找不到讓我們檢查是否啟用自動縮放的 powershell 腳本或命令。 我指的是以下文檔,它只有一個啟用自動縮放的命令。
您可以通過檢查 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.