是否可以使 Azure 弹性池自动缩放?



如标题所示,我正在尝试自动缩放我的 Azure 数据库。我找到了单个数据库的Powershell工作流脚本,它运行良好。我想知道是否可以自动缩放我的弹性池。我曾尝试重写剧本,但多次失败。

下面是脚本:

workflow Set-AzureSqlDatabaseEdition 
{ 
param 
( 
# Name of the Azure SQL Database server (Ex: bzb98er9bp) 
[parameter(Mandatory=$true)]  
[string] $SqlServerName, 
# Target Azure SQL Elastic Pool
[parameter(Mandatory=$true)]  
[string] $ElasticPoolName, 
# Desired Azure SQL Elastic Pool edition {Basic, Standard, Premium} 
[parameter(Mandatory=$true)]  
[string] $Edition, 
# Desired DTU 
[parameter(Mandatory=$true)]  
[string] $DTU, 
# DatabaseDtuMin  
[parameter(Mandatory=$true)]
[string] $DatabaseDtuMin,
# DatabaseDtuMax
[parameter(Mandatory=$true)]
[string] $DatabaseDtuMax,
# Credentials for $SqlServerName stored as an Azure Automation credential asset 
# When using in the Azure Automation UI, please enter the name of the credential asset for the "Credential" parameter 
[parameter(Mandatory=$true)]  
[PSCredential] $Credential 
) 
inlinescript 
{ 
Write-Output "Begin vertical scaling script..." 
# Establish credentials for Azure SQL Database server  
$Servercredential = new-object System.Management.Automation.PSCredential($Using:Credential.UserName, (($Using:Credential).GetNetworkCredential().Password | ConvertTo-SecureString -asPlainText -Force))  
# Create connection context for Azure SQL Database server 
$CTX = New-AzureSqlDatabaseServerContext -ManageUrl “https://$Using:SqlServerName.database.windows.net” -Credential $ServerCredential 
# Get Azure Elastic Pool context 
$EP = Get-AzureRmSqlElasticPool $CTX ElasticPoolName $Using:ElasticPoolName 
# Specify the specific performance level for the target $DatabaseName 
$DTU = Get-AzureRmSqlElasticPool $CTX ElasticPoolName $Using:DTU 
# Set the new edition/performance level 
Set-AzureRmSqlElasticPool $CTX ElasticPoolName $DTU –ServiceObjective $DTU –Edition $Using:Edition -Force 
# Output final status message 
Write-Output "Scaled the performance level of $Using:DatabaseName to $Using:Edition - $Using:PerfLevel" 
Write-Output "Completed vertical scale" 
} 
}

如果可能的话,我希望有人能为我指出一个正确的方向。

非常感谢!!

请参阅 https://learn.microsoft.com/en-us/azure/sql-database/scripts/sql-database-monitor-and-scale-pool-powershell

此 PowerShell 脚本示例监视弹性池的性能指标,将其缩放到更高的性能级别,并针对其中一个性能指标创建警报规则。

PS C:>Set-AzSqlElasticPool 
-ResourceGroupName "ResourceGroup01" 
-ServerName "Server01" 
-ElasticPoolName "ElasticPool01" 
-Dtu 1000 
-DatabaseDtuMax 100 
-DatabaseDtuMin 20
ResourceId        : /subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/resourcegroup01/providers/Microsoft.Sql/servers/Server01/elasticPools/ElasticPool01
ResourceGroupName : ResourceGroup01
ServerName        : Server01
ElasticPoolName   : ElasticPool01
Location          : Central US
CreationDate      : 8/26/2015 10:00:17 PM
State             : Ready
Edition           : Standard
Dtu               : 200
DatabaseDtuMax    : 100
DatabaseDtuMin    : 20
StorageMB         : 204800
Tags              :

如果您对第三方产品持开放态度,请查看 CloudMonix - 它具有一项功能,可以通过任何指标和/或日期时间自动缩放弹性池、SQL 仓库和 SQL Azure 数据库。

您可以在其中定义比例范围和比例调整。 缩放范围通常是基于时间的条件,缩放发生在这些标准之间(即:上午 9 点至下午 5 点,最小层为 P3,最大值为 P5,依此类推(,规模调整是基于某种性能指标的层增量移动(DTU> 80 或网站上的请求/秒> 50 等(

无需电源外壳

相关内容

  • 没有找到相关文章