你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Bicep资源定义
可以使用目标操作部署群集/应用程序/服务资源类型:
- 资源组 - 参见 资源组部署命令
有关每个 API 版本中已更改属性的列表,请参阅 更改日志。
资源格式
要创建 Microsoft.ServiceFabric/clusters/applications/services 资源,请将以下 Bicep 添加到模板中。
resource symbolicname 'Microsoft.ServiceFabric/clusters/applications/services@2019-03-01' = {
parent: resourceSymbolicName
location: 'string'
name: 'string'
properties: {
correlationScheme: [
{
scheme: 'string'
serviceName: 'string'
}
]
defaultMoveCost: 'string'
partitionDescription: {
partitionScheme: 'string'
// For remaining properties, see PartitionSchemeDescription objects
}
placementConstraints: 'string'
serviceLoadMetrics: [
{
defaultLoad: int
name: 'string'
primaryDefaultLoad: int
secondaryDefaultLoad: int
weight: 'string'
}
]
servicePackageActivationMode: 'string'
servicePlacementPolicies: [
{
Type: 'string'
// For remaining properties, see ServicePlacementPolicyDescription objects
}
]
serviceTypeName: 'string'
serviceKind: 'string'
// For remaining properties, see ServiceResourceProperties objects
}
tags: {
{customized property}: 'string'
}
}
PartitionSchemeDescription 对象
设置 partitionScheme 属性以指定对象的类型。
对于 “已命名”,请使用:
{
Count: int
Names: [
'string'
]
partitionScheme: 'Named'
}
对于 单例,请使用:
{
partitionScheme: 'Singleton'
}
对于 UniformInt64Range,请使用:
{
Count: int
HighKey: 'string'
LowKey: 'string'
partitionScheme: 'UniformInt64Range'
}
ServiceResourceProperties 对象
设置 serviceKind 属性以指定对象的类型。
对于 有状态,请使用:
{
hasPersistedState: bool
minReplicaSetSize: int
quorumLossWaitDuration: 'string'
replicaRestartWaitDuration: 'string'
serviceKind: 'Stateful'
standByReplicaKeepDuration: 'string'
targetReplicaSetSize: int
}
对于 无状态,请使用:
{
instanceCount: int
serviceKind: 'Stateless'
}
ServicePlacementPolicyDescription 对象
设置 Type 属性以指定对象的类型。
属性值
Microsoft.ServiceFabric/clusters/applications/services
| Name | Description | Value |
|---|---|---|
| 位置 | 新 API 中会弃用它,资源位置取决于父资源。 | 字符串 |
| name | 资源名称 | string (必需) |
| 父级 | 在 Bicep 中,你可以指定子资源的父资源。 仅当子资源在父资源外部声明时,才需要添加此属性。 更多信息请参见Child 资源 outside parent resource。 |
资源类型的符号名称: clusters/applications |
| properties | 服务资源属性。 | ServiceResourceProperties |
| tags | 资源标记 | 标记名称和值的字典。 请参见模板中的标签 |
NamedPartitionSchemeDescription
| Name | Description | Value |
|---|---|---|
| Count | 分区数。 | int (必需) |
| Names | 由“Count”参数为分区名称指定的大小数组。 | string[] (必需) |
| partitionScheme | 指定如何对服务进行分区。 | “已命名”(必填) |
PartitionSchemeDescription
| Name | Description | Value |
|---|---|---|
| partitionScheme | 将类型 NamedPartitionSchemeDescription 设置为“Named”。 将 SingletonPartitionSchemeDescription 类型设置为“Singleton”。 对于 类型 UniformInt64RangePartitionSchemeDescription,设置为“UniformInt64Range”。 | 'Named' 'Singleton' 'UniformInt64Range'(必填) |
ProxyResourceTags
| Name | Description | Value |
|---|
ServiceCorrelationDescription
| Name | Description | Value |
|---|---|---|
| scheme | ServiceCorrelationScheme,描述此服务与通过 ServiceName 指定的服务之间的关系。 | 'Affinity' 'AlignedAffinity' 'Invalid' 'NonAlignedAffinity'(必需) |
| serviceName | 与关联关系建立的服务的名称。 | string (必需) |
ServiceLoadMetricDescription
| Name | Description | Value |
|---|---|---|
| defaultLoad | 仅用于无状态服务。 此服务为此指标创建的默认负载量(以数字表示)。 | int |
| name | 指标的名称。 如果服务选择在运行时报告负载,则负载指标名称应与 Name 中指定的名称完全匹配。 请注意,指标名称区分大小写。 | string (必需) |
| primaryDefaultLoad | 仅用于有状态服务。 此服务在作为主要副本时为此指标创建的默认负载量(作为数字)。 | int |
| secondaryDefaultLoad | 仅用于有状态服务。 此服务在作为次要副本时为此指标创建的默认负载量(作为数字)。 | int |
| weight | 与为此服务配置的其他指标相比,服务负载指标相对权重为数字。 | 'High' 'Low' 'Medium' 'Zero' |
ServicePlacementPolicyDescription
| Name | Description | Value |
|---|---|---|
| 类型 | (required) |
ServiceResourceProperties
| Name | Description | Value |
|---|---|---|
| correlationScheme | 描述服务与其他服务关联的列表。 | ServiceCorrelationDescription[] |
| defaultMoveCost | 指定服务的移动成本。 | 'High' 'Low' 'Medium' 'Zero' |
| partitionDescription | 描述如何对服务进行分区。 | PartitionSchemeDescription |
| placementConstraints | 作为字符串的放置约束。 放置约束是节点属性上的布尔表达式,允许根据服务要求将服务限制为特定节点。 例如,若要在 NodeType 为蓝色的节点上放置服务,请指定以下内容:“NodeColor == blue”。。 | 字符串 |
| serviceKind | 将 类型 StatefulServiceProperties 设置为“Stateful”。 将 类型 StatelessServiceProperties 设置为“Stateless”。 | 'Stateful' “无状态”(必需) |
| serviceLoadMetrics | 服务负载指标作为 ServiceLoadMetricDescription 对象的数组提供。 | ServiceLoadMetricDescription[] |
| servicePackageActivationMode | 服务包的激活模式 | 'ExclusiveProcess' 'SharedProcess' |
| servicePlacementPolicies | 描述服务与其他服务关联的列表。 | ServicePlacementPolicyDescription[] |
| serviceTypeName | 服务类型的名称 | 字符串 |
SingletonPartitionSchemeDescription
| Name | Description | Value |
|---|---|---|
| partitionScheme | 指定如何对服务进行分区。 | “单例”(必填) |
StatefulServiceProperties
| Name | Description | Value |
|---|---|---|
| hasPersistedState | 一个标志,指示这是一个持久服务,用于将状态存储在本地磁盘上。 如果是,则此属性的值为 true,否则为 false。 | bool |
| minReplicaSetSize | 最小副本集大小为数字。 | int Constraints: 最小值 = 1 |
| quorumLossWaitDuration | 允许分区处于仲裁丢失状态(以 ISO 8601 格式(hh:mm:ss.s)表示的最大持续时间。 | 字符串 |
| replicaRestartWaitDuration | 副本关闭和创建新副本之间的持续时间(以 ISO 8601 格式(hh:mm:ss.s) 表示。 | 字符串 |
| serviceKind | 服务类型(无状态或有状态服务)。 | “有状态”(必填) |
| standByReplicaKeepDuration | 在删除之前应保留 StandBy 副本的定义(以 ISO 8601 格式(hh:mm:ss.s)表示。 | 字符串 |
| targetReplicaSetSize | 目标副本集大小为数字。 | int Constraints: 最小值 = 1 |
StatelessServiceProperties
| Name | Description | Value |
|---|---|---|
| instanceCount | 实例计数。 | int Constraints: 最小值 = -1 |
| serviceKind | 服务类型(无状态或有状态服务)。 | “无状态”(必需) |
UniformInt64RangePartitionSchemeDescription
| Name | Description | Value |
|---|---|---|
| Count | 分区数。 | int (必需) |
| HighKey | 指示分区键范围的上限的字符串 应在分区“Count”之间拆分 |
string (必需) |
| LowKey | 指示分区键范围的下限的字符串 应在分区“Count”之间拆分 |
string (必需) |
| partitionScheme | 指定如何对服务进行分区。 | 'UniformInt64Range'(必填) |
ARM 模板资源定义
可以使用目标操作部署群集/应用程序/服务资源类型:
用法示例
资源格式
若要创建 Microsoft.ServiceFabric/clusters/applications/services 资源,请将以下 JSON 添加到模板。
{
"type": "Microsoft.ServiceFabric/clusters/applications/services",
"apiVersion": "2019-03-01",
"name": "string",
"location": "string",
"properties": {
"correlationScheme": [
{
"scheme": "string",
"serviceName": "string"
}
],
"defaultMoveCost": "string",
"partitionDescription": {
"partitionScheme": "string"
// For remaining properties, see PartitionSchemeDescription objects
},
"placementConstraints": "string",
"serviceLoadMetrics": [
{
"defaultLoad": "int",
"name": "string",
"primaryDefaultLoad": "int",
"secondaryDefaultLoad": "int",
"weight": "string"
}
],
"servicePackageActivationMode": "string",
"servicePlacementPolicies": [ {
"Type": "string"
// For remaining properties, see ServicePlacementPolicyDescription objects
} ],
"serviceTypeName": "string",
"serviceKind": "string"
// For remaining properties, see ServiceResourceProperties objects
},
"tags": {
"{customized property}": "string"
}
}
PartitionSchemeDescription 对象
设置 partitionScheme 属性以指定对象的类型。
对于 “已命名”,请使用:
{
"Count": "int",
"Names": [ "string" ],
"partitionScheme": "Named"
}
对于 单例,请使用:
{
"partitionScheme": "Singleton"
}
对于 UniformInt64Range,请使用:
{
"Count": "int",
"HighKey": "string",
"LowKey": "string",
"partitionScheme": "UniformInt64Range"
}
ServiceResourceProperties 对象
设置 serviceKind 属性以指定对象的类型。
对于 有状态,请使用:
{
"hasPersistedState": "bool",
"minReplicaSetSize": "int",
"quorumLossWaitDuration": "string",
"replicaRestartWaitDuration": "string",
"serviceKind": "Stateful",
"standByReplicaKeepDuration": "string",
"targetReplicaSetSize": "int"
}
对于 无状态,请使用:
{
"instanceCount": "int",
"serviceKind": "Stateless"
}
ServicePlacementPolicyDescription 对象
设置 Type 属性以指定对象的类型。
属性值
Microsoft.ServiceFabric/clusters/applications/services
| Name | Description | Value |
|---|---|---|
| apiVersion | API 版本 | '2019-03-01' |
| 位置 | 新 API 中会弃用它,资源位置取决于父资源。 | 字符串 |
| name | 资源名称 | string (必需) |
| properties | 服务资源属性。 | ServiceResourceProperties |
| tags | 资源标记 | 标记名称和值的字典。 请参见模板中的标签 |
| 类型 | 资源类型 | 'Microsoft.ServiceFabric/clusters/applications/services' |
NamedPartitionSchemeDescription
| Name | Description | Value |
|---|---|---|
| Count | 分区数。 | int (必需) |
| Names | 由“Count”参数为分区名称指定的大小数组。 | string[] (必需) |
| partitionScheme | 指定如何对服务进行分区。 | “已命名”(必填) |
PartitionSchemeDescription
| Name | Description | Value |
|---|---|---|
| partitionScheme | 将类型 NamedPartitionSchemeDescription 设置为“Named”。 将 SingletonPartitionSchemeDescription 类型设置为“Singleton”。 对于 类型 UniformInt64RangePartitionSchemeDescription,设置为“UniformInt64Range”。 | 'Named' 'Singleton' 'UniformInt64Range'(必填) |
ProxyResourceTags
| Name | Description | Value |
|---|
ServiceCorrelationDescription
| Name | Description | Value |
|---|---|---|
| scheme | ServiceCorrelationScheme,描述此服务与通过 ServiceName 指定的服务之间的关系。 | 'Affinity' 'AlignedAffinity' 'Invalid' 'NonAlignedAffinity'(必需) |
| serviceName | 与关联关系建立的服务的名称。 | string (必需) |
ServiceLoadMetricDescription
| Name | Description | Value |
|---|---|---|
| defaultLoad | 仅用于无状态服务。 此服务为此指标创建的默认负载量(以数字表示)。 | int |
| name | 指标的名称。 如果服务选择在运行时报告负载,则负载指标名称应与 Name 中指定的名称完全匹配。 请注意,指标名称区分大小写。 | string (必需) |
| primaryDefaultLoad | 仅用于有状态服务。 此服务在作为主要副本时为此指标创建的默认负载量(作为数字)。 | int |
| secondaryDefaultLoad | 仅用于有状态服务。 此服务在作为次要副本时为此指标创建的默认负载量(作为数字)。 | int |
| weight | 与为此服务配置的其他指标相比,服务负载指标相对权重为数字。 | 'High' 'Low' 'Medium' 'Zero' |
ServicePlacementPolicyDescription
| Name | Description | Value |
|---|---|---|
| 类型 | (required) |
ServiceResourceProperties
| Name | Description | Value |
|---|---|---|
| correlationScheme | 描述服务与其他服务关联的列表。 | ServiceCorrelationDescription[] |
| defaultMoveCost | 指定服务的移动成本。 | 'High' 'Low' 'Medium' 'Zero' |
| partitionDescription | 描述如何对服务进行分区。 | PartitionSchemeDescription |
| placementConstraints | 作为字符串的放置约束。 放置约束是节点属性上的布尔表达式,允许根据服务要求将服务限制为特定节点。 例如,若要在 NodeType 为蓝色的节点上放置服务,请指定以下内容:“NodeColor == blue”。。 | 字符串 |
| serviceKind | 将 类型 StatefulServiceProperties 设置为“Stateful”。 将 类型 StatelessServiceProperties 设置为“Stateless”。 | 'Stateful' “无状态”(必需) |
| serviceLoadMetrics | 服务负载指标作为 ServiceLoadMetricDescription 对象的数组提供。 | ServiceLoadMetricDescription[] |
| servicePackageActivationMode | 服务包的激活模式 | 'ExclusiveProcess' 'SharedProcess' |
| servicePlacementPolicies | 描述服务与其他服务关联的列表。 | ServicePlacementPolicyDescription[] |
| serviceTypeName | 服务类型的名称 | 字符串 |
SingletonPartitionSchemeDescription
| Name | Description | Value |
|---|---|---|
| partitionScheme | 指定如何对服务进行分区。 | “单例”(必填) |
StatefulServiceProperties
| Name | Description | Value |
|---|---|---|
| hasPersistedState | 一个标志,指示这是一个持久服务,用于将状态存储在本地磁盘上。 如果是,则此属性的值为 true,否则为 false。 | bool |
| minReplicaSetSize | 最小副本集大小为数字。 | int Constraints: 最小值 = 1 |
| quorumLossWaitDuration | 允许分区处于仲裁丢失状态(以 ISO 8601 格式(hh:mm:ss.s)表示的最大持续时间。 | 字符串 |
| replicaRestartWaitDuration | 副本关闭和创建新副本之间的持续时间(以 ISO 8601 格式(hh:mm:ss.s) 表示。 | 字符串 |
| serviceKind | 服务类型(无状态或有状态服务)。 | “有状态”(必填) |
| standByReplicaKeepDuration | 在删除之前应保留 StandBy 副本的定义(以 ISO 8601 格式(hh:mm:ss.s)表示。 | 字符串 |
| targetReplicaSetSize | 目标副本集大小为数字。 | int Constraints: 最小值 = 1 |
StatelessServiceProperties
| Name | Description | Value |
|---|---|---|
| instanceCount | 实例计数。 | int Constraints: 最小值 = -1 |
| serviceKind | 服务类型(无状态或有状态服务)。 | “无状态”(必需) |
UniformInt64RangePartitionSchemeDescription
| Name | Description | Value |
|---|---|---|
| Count | 分区数。 | int (必需) |
| HighKey | 指示分区键范围的上限的字符串 应在分区“Count”之间拆分 |
string (必需) |
| LowKey | 指示分区键范围的下限的字符串 应在分区“Count”之间拆分 |
string (必需) |
| partitionScheme | 指定如何对服务进行分区。 | 'UniformInt64Range'(必填) |
Terraform (AzAPI 提供程序)资源定义
可以使用目标操作部署群集/应用程序/服务资源类型:
- 资源组 关于每个API版本中变更属性的列表,请参见 更改日志。
资源格式
若要创建 Microsoft.ServiceFabric/clusters/applications/services 资源,请将以下 Terraform 添加到模板。
resource "azapi_resource" "symbolicname" {
type = "Microsoft.ServiceFabric/clusters/applications/services@2019-03-01"
name = "string"
parent_id = "string"
location = "string"
tags = {
{customized property} = "string"
}
body = {
properties = {
correlationScheme = [
{
scheme = "string"
serviceName = "string"
}
]
defaultMoveCost = "string"
partitionDescription = {
partitionScheme = "string"
// For remaining properties, see PartitionSchemeDescription objects
}
placementConstraints = "string"
serviceLoadMetrics = [
{
defaultLoad = int
name = "string"
primaryDefaultLoad = int
secondaryDefaultLoad = int
weight = "string"
}
]
servicePackageActivationMode = "string"
servicePlacementPolicies = [
{
Type = "string"
// For remaining properties, see ServicePlacementPolicyDescription objects
}
]
serviceTypeName = "string"
serviceKind = "string"
// For remaining properties, see ServiceResourceProperties objects
}
}
}
PartitionSchemeDescription 对象
设置 partitionScheme 属性以指定对象的类型。
对于 “已命名”,请使用:
{
Count = int
Names = [
"string"
]
partitionScheme = "Named"
}
对于 单例,请使用:
{
partitionScheme = "Singleton"
}
对于 UniformInt64Range,请使用:
{
Count = int
HighKey = "string"
LowKey = "string"
partitionScheme = "UniformInt64Range"
}
ServiceResourceProperties 对象
设置 serviceKind 属性以指定对象的类型。
对于 有状态,请使用:
{
hasPersistedState = bool
minReplicaSetSize = int
quorumLossWaitDuration = "string"
replicaRestartWaitDuration = "string"
serviceKind = "Stateful"
standByReplicaKeepDuration = "string"
targetReplicaSetSize = int
}
对于 无状态,请使用:
{
instanceCount = int
serviceKind = "Stateless"
}
ServicePlacementPolicyDescription 对象
设置 Type 属性以指定对象的类型。
属性值
Microsoft.ServiceFabric/clusters/applications/services
| Name | Description | Value |
|---|---|---|
| 位置 | 新 API 中会弃用它,资源位置取决于父资源。 | 字符串 |
| name | 资源名称 | string (必需) |
| parent_id | 此资源的父资源的 ID。 | 类型为:集群/应用程序的资源的 ID |
| properties | 服务资源属性。 | ServiceResourceProperties |
| tags | 资源标记 | 标记名称和值的字典。 |
| 类型 | 资源类型 | "Microsoft.ServiceFabric/clusters/applications/services@2019-03-01" |
NamedPartitionSchemeDescription
| Name | Description | Value |
|---|---|---|
| Count | 分区数。 | int (必需) |
| Names | 由“Count”参数为分区名称指定的大小数组。 | string[] (必需) |
| partitionScheme | 指定如何对服务进行分区。 | “已命名”(必填) |
PartitionSchemeDescription
| Name | Description | Value |
|---|---|---|
| partitionScheme | 将类型 NamedPartitionSchemeDescription 设置为“Named”。 将 SingletonPartitionSchemeDescription 类型设置为“Singleton”。 对于 类型 UniformInt64RangePartitionSchemeDescription,设置为“UniformInt64Range”。 | 'Named' 'Singleton' 'UniformInt64Range'(必填) |
ProxyResourceTags
| Name | Description | Value |
|---|
ServiceCorrelationDescription
| Name | Description | Value |
|---|---|---|
| scheme | ServiceCorrelationScheme,描述此服务与通过 ServiceName 指定的服务之间的关系。 | 'Affinity' 'AlignedAffinity' 'Invalid' 'NonAlignedAffinity'(必需) |
| serviceName | 与关联关系建立的服务的名称。 | string (必需) |
ServiceLoadMetricDescription
| Name | Description | Value |
|---|---|---|
| defaultLoad | 仅用于无状态服务。 此服务为此指标创建的默认负载量(以数字表示)。 | int |
| name | 指标的名称。 如果服务选择在运行时报告负载,则负载指标名称应与 Name 中指定的名称完全匹配。 请注意,指标名称区分大小写。 | string (必需) |
| primaryDefaultLoad | 仅用于有状态服务。 此服务在作为主要副本时为此指标创建的默认负载量(作为数字)。 | int |
| secondaryDefaultLoad | 仅用于有状态服务。 此服务在作为次要副本时为此指标创建的默认负载量(作为数字)。 | int |
| weight | 与为此服务配置的其他指标相比,服务负载指标相对权重为数字。 | 'High' 'Low' 'Medium' 'Zero' |
ServicePlacementPolicyDescription
| Name | Description | Value |
|---|---|---|
| 类型 | (required) |
ServiceResourceProperties
| Name | Description | Value |
|---|---|---|
| correlationScheme | 描述服务与其他服务关联的列表。 | ServiceCorrelationDescription[] |
| defaultMoveCost | 指定服务的移动成本。 | 'High' 'Low' 'Medium' 'Zero' |
| partitionDescription | 描述如何对服务进行分区。 | PartitionSchemeDescription |
| placementConstraints | 作为字符串的放置约束。 放置约束是节点属性上的布尔表达式,允许根据服务要求将服务限制为特定节点。 例如,若要在 NodeType 为蓝色的节点上放置服务,请指定以下内容:“NodeColor == blue”。。 | 字符串 |
| serviceKind | 将 类型 StatefulServiceProperties 设置为“Stateful”。 将 类型 StatelessServiceProperties 设置为“Stateless”。 | 'Stateful' “无状态”(必需) |
| serviceLoadMetrics | 服务负载指标作为 ServiceLoadMetricDescription 对象的数组提供。 | ServiceLoadMetricDescription[] |
| servicePackageActivationMode | 服务包的激活模式 | 'ExclusiveProcess' 'SharedProcess' |
| servicePlacementPolicies | 描述服务与其他服务关联的列表。 | ServicePlacementPolicyDescription[] |
| serviceTypeName | 服务类型的名称 | 字符串 |
SingletonPartitionSchemeDescription
| Name | Description | Value |
|---|---|---|
| partitionScheme | 指定如何对服务进行分区。 | “单例”(必填) |
StatefulServiceProperties
| Name | Description | Value |
|---|---|---|
| hasPersistedState | 一个标志,指示这是一个持久服务,用于将状态存储在本地磁盘上。 如果是,则此属性的值为 true,否则为 false。 | bool |
| minReplicaSetSize | 最小副本集大小为数字。 | int Constraints: 最小值 = 1 |
| quorumLossWaitDuration | 允许分区处于仲裁丢失状态(以 ISO 8601 格式(hh:mm:ss.s)表示的最大持续时间。 | 字符串 |
| replicaRestartWaitDuration | 副本关闭和创建新副本之间的持续时间(以 ISO 8601 格式(hh:mm:ss.s) 表示。 | 字符串 |
| serviceKind | 服务类型(无状态或有状态服务)。 | “有状态”(必填) |
| standByReplicaKeepDuration | 在删除之前应保留 StandBy 副本的定义(以 ISO 8601 格式(hh:mm:ss.s)表示。 | 字符串 |
| targetReplicaSetSize | 目标副本集大小为数字。 | int Constraints: 最小值 = 1 |
StatelessServiceProperties
| Name | Description | Value |
|---|---|---|
| instanceCount | 实例计数。 | int Constraints: 最小值 = -1 |
| serviceKind | 服务类型(无状态或有状态服务)。 | “无状态”(必需) |
UniformInt64RangePartitionSchemeDescription
| Name | Description | Value |
|---|---|---|
| Count | 分区数。 | int (必需) |
| HighKey | 指示分区键范围的上限的字符串 应在分区“Count”之间拆分 |
string (必需) |
| LowKey | 指示分区键范围的下限的字符串 应在分区“Count”之间拆分 |
string (必需) |
| partitionScheme | 指定如何对服务进行分区。 | 'UniformInt64Range'(必填) |