ksp*_*rin 36 azure azure-elastic-scale azure-sql-database
我们有一个使用Azure SQL作为数据库后端的应用程序.在正常负载/条件下,此数据库可以在Premium 1计划上成功运行.但是,在凌晨时分,我们有一些工作会增加数据库负载.在这几个小时内,我们需要转向Premium 3计划.Premium 3的成本大约是8倍,所以显然我们不想支付全天候运行此计划的成本.
是否可以上下自动调整数据库?云服务提供了一种简单的方法来扩展Azure门户中的实例数量,但是,Azure SQL数据库不存在这样的情况.可以使用Azure SDK以编程方式完成吗?我无法找到有关此主题的任何文档.
ksp*_*rin 18
在深入了解@ ErikEJ的答案(谢谢!)之后,我能够找到以下内容,这些内容似乎是随着Elastic Scale预览的发布而新发布的:
现在还提供了以下REST API,它们可以让您在数据库中执行任何操作:
对于我缩放服务层的原始问题(例如P1 - > P3 - > P1):
通过这些新的开发,我将假设自动缩放也可以作为Azure门户中的简单配置提供,这与云服务非常相似.
Eri*_*kEJ 12
是的,该功能可用:Azure SQL数据库弹性比例
https://docs.microsoft.com/en-gb/azure/sql-database/sql-database-elastic-scale-introduction
Chr*_*han 12
另一种方法是使用Azure自动化并使用下面的运行手册:
param
(
# Desired Azure SQL Database edition {Basic, Standard, Premium}
[parameter(Mandatory=$true)]
[string] $Edition,
# Desired performance level {Basic, S0, S1, S2, P1, P2, P3}
[parameter(Mandatory=$true)]
[string] $PerfLevel
)
inlinescript
{
# I only care about 1 DB so, I put it into variable asset and access from here
$SqlServerName = Get-AutomationVariable -Name 'SqlServerName'
$DatabaseName = Get-AutomationVariable -Name 'DatabaseName'
Write-Output "Begin vertical scaling script..."
# Establish credentials for Azure SQL Database server
$Servercredential = new-object System.Management.Automation.PSCredential("yourDBadmin", ("YourPassword" | ConvertTo-SecureString -asPlainText -Force))
# Create connection context for Azure SQL Database server
$CTX = New-AzureSqlDatabaseServerContext -ManageUrl “https://$SqlServerName.database.windows.net” -Credential $ServerCredential
# Get Azure SQL Database context
$Db = Get-AzureSqlDatabase $CTX –DatabaseName $DatabaseName
# Specify the specific performance level for the target $DatabaseName
$ServiceObjective = Get-AzureSqlDatabaseServiceObjective $CTX -ServiceObjectiveName "$Using:PerfLevel"
# Set the new edition/performance level
Set-AzureSqlDatabase $CTX –Database $Db –ServiceObjective $ServiceObjective –Edition $Using:Edition -Force
# Output final status message
Write-Output "Scaled the performance level of $DatabaseName to $Using:Edition - $Using:PerfLevel"
Write-Output "Completed vertical scale"
}
Run Code Online (Sandbox Code Playgroud)
参考:
Azure垂直
扩展Runbook当您想要向上/向下扩展时设置时间表.
对我来说,我使用2个带有输入参数的时间表,1个用于放大,另一个用于缩小.
希望有所帮助.
在某些情况下,最简单的选择可能是运行SQL查询,如msdn中所述.
例如:
ALTER DATABASE [database_name] MODIFY (EDITION = 'standard', SERVICE_OBJECTIVE = 'S3', MAXSIZE = 250 GB)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14135 次 |
| 最近记录: |