azure - SQL DB 超大规模 ServiceObjectiveName/Cores
问题描述
我正在使用 .net SDK 的 azure 库并遇到了一个问题。
如果 DatabaseEdition 是 Hyperscale,ServiceObjectiveName 有哪些可用选项?
当我创建一个超大规模数据库时,我相信 ServiceObjectiveName 默认是 Gen4。有没有办法指定 Gen5 和核心数量?
我找到了 ServiceObjectiveNames 列表,但它们似乎都与超大规模值无关。 https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.management.sql.models.serviceobjectivename?view=azure-dotnet
- Basic DS100 DS1000 DS1200 DS1500 DS200 DS2000 DS300 DS400 DS500 DS600 DW100 DW1000 DW10000c DW1000c DW1200 DW1500 DW15000c DW1500c DW200 DW2000 DW2000c DW2500c DW300 DW3000 DW30000c DW3000c DW400 DW500 DW5000c DW600 DW6000 DW6000c DW7500c ElasticPool Free P1 P11 P15 P2 P3 P4 P6 PRS1 PRS2 PRS4 PRS6 S0 S1 S12 S2 S3 S4 S6 S7 S9 系统 System0 System1 System2 System2L System3 System3L System4 System4L
解决方案
根据我的测试,如果我们使用Azure Management Libraries for .NET创建 Hyperscale Gen5 数据库,我们可以使用方法ServiceObjectiveName.Parse("")
来指定 Gen5 和内核数量。
例如
如果我们使用ServiceObjectiveName.Parse("HS_Gen5_2")
,则表示该数据库是 Hyperscale: Gen5, 2 vCores。
详细步骤如下:
- 创建服务主体并将角色分配给 sp
az ad sp create-for-rbac --name ServicePrincipalName --role contributor
- 代码:
var tenantId = "<your tenant id>";
var clientId = "<your sp app id>";
var clientSecret = <your sp password>;
var SubscriptionId = "<your subscription id>";
var credentials = SdkContext.AzureCredentialsFactory.FromServicePrincipal(
clientId,
clientSecret,
tenantId,
AzureEnvironment.AzureGlobalCloud);
var azure = Microsoft.Azure.Management.Fluent.Azure.Configure()
.WithLogLevel(HttpLoggingDelegatingHandler.Level.Basic)
.Authenticate(credentials)
.WithSubscription(SubscriptionId);
var sqlServer = azure.SqlServers.GetByResourceGroup("test", "testsql07");
Console.WriteLine(sqlServer.Name);
var database = await sqlServer.Databases.Define("test1")
.WithEdition(DatabaseEdition.Hyperscale)
.WithServiceObjective(ServiceObjectiveName.Parse("HS_Gen5_2"))
.CreateAsync();
Console.WriteLine(database.Edition.Value);
Console.WriteLine(database.RequestedServiceObjectiveName.Value);
推荐阅读
- jquery - 监听页面更改事件
- java - 单击选项卡时JavaFX什么都不做
- apache-spark - Hive 分区、分桶和排序表 - 多个插入
- node.js - 使用 Node Js 的 AWS Lambda 在 http.request() 上提供“连接 ETIMEDOUT”
- python - __getitem__ 的 idx 如何在 PyTorch 的 DataLoader 中工作?
- javascript - scrollTop 在 iOS Safari 上的行为完全相反
- javascript - 我们可以使用 jsx 字段生成对象吗?
- javascript - 从 Object.freeze 获取随机对象
- javascript - Meteor 1.8.1 SSL 双连接
- stormcrawler - AWS 节点上的 Storm-crawler 种子注入失败