你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

az sf service

管理在 Azure Service Fabric 群集上运行的服务。 仅支持 ARM 部署的服务。

命令

名称 说明 类型 状态
az sf service create

在 Azure Service Fabric 群集上创建新服务。

核心 GA
az sf service delete

删除服务。

核心 GA
az sf service list

列出给定应用程序的服务。

核心 GA
az sf service show

获取服务。

核心 GA

az sf service create

在 Azure Service Fabric 群集上创建新服务。

az sf service create --application
                     --cluster-name
                     --name
                     --resource-group
                     --service-type
                     --state {stateful, stateless}
                     [--default-move-cost {High, Low, Medium, Zero}]
                     [--instance-count]
                     [--min-replica]
                     [--partition-scheme {named, singleton, uniformInt64}]
                     [--target-replica]

示例

使用实例计数 -1(在所有节点上)创建新的无状态服务“testApp~testService1”。

az sf service create -g testRG -c testCluster --application-name testApp --state stateless --service-name testApp~testService \
  --service-type testStateless --instance-count -1 --partition-scheme singleton

使用 5 个节点的目标创建新的有状态服务“testApp~testService2”。

az sf service create -g testRG -c testCluster --application-name testApp --state stateful --service-name testApp~testService2 \
  --service-type testStatefulType --min-replica-set-size 3 --target-replica-set-size 5

必需参数

--application --application-name

指定服务的名称。 应用程序名称必须是服务名称的前缀,例如:appName~serviceName。

--cluster-name -c

指定群集的名称(如果未指定),则与资源组名称相同。

--name --service-name

指定服务的名称。 应用程序名称必须是服务名称的前缀,例如:appName~serviceName。

--resource-group -g

指定资源组名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--service-type

指定应用程序的服务类型名称,它应存在于应用程序清单中。

--state

指定服务是无状态还是有状态。

接受的值: stateful, stateless

可选参数

--default-move-cost

指定移动的默认成本。 成本越高,群集资源管理器在尝试平衡群集时将移动副本 (replica)的可能性更低。

接受的值: High, Low, Medium, Zero
--instance-count

指定无状态服务的实例计数。 如果使用 -1,则表示它将在所有节点上运行。

--min-replica --min-replica-set-size

指定有状态服务的最小副本 (replica)设置大小。

--partition-scheme

指定要使用的分区方案。 单独分区通常在服务不需要任何其他路由时使用。 UniformInt64 表示每个分区拥有一系列 int64 键。 命名通常适用于可在边界集中存储的数据的服务。 用作命名分区键的数据字段的一些常见示例是区域、邮政编码、客户组或其他业务边界。

接受的值: named, singleton, uniformInt64
默认值: singleton
--target-replica --target-replica-set-size

指定有状态服务的目标副本 (replica)设置大小。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az sf service delete

删除服务。

az sf service delete --application-name
                     --cluster-name
                     --name
                     --resource-group

示例

删除服务。

az sf service delete -g testRG -c testCluster --application-name testApp --service-name testApp~testService

必需参数

--application-name

应用程序资源的名称。 必需。

--cluster-name -c

指定群集的名称(如果未指定),则与资源组名称相同。

--name --service-name

指定服务的名称。 应用程序名称必须是服务名称的前缀,例如:appName~serviceName。

--resource-group -g

指定资源组名称。 可以使用 az configure --defaults group=<name> 配置默认组。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az sf service list

列出给定应用程序的服务。

az sf service list --application-name
                   --cluster-name
                   --resource-group

示例

列出服务。

az sf service list -g testRG -c testCluster --application-name testApp

必需参数

--application-name

应用程序资源的名称。 必需。

--cluster-name -c

指定群集的名称(如果未指定),则与资源组名称相同。

--resource-group -g

指定资源组名称。 可以使用 az configure --defaults group=<name> 配置默认组。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az sf service show

获取服务。

az sf service show --application-name
                   --cluster-name
                   --name
                   --resource-group

示例

显示 Azure Service Fabric 群集上服务的属性。

az sf service show -g testRG -c testCluster --application-name testApp --service-name testApp~testService

必需参数

--application-name

应用程序资源的名称。 必需。

--cluster-name -c

指定群集的名称(如果未指定),则与资源组名称相同。

--name --service-name

指定服务的名称。 应用程序名称必须是服务名称的前缀,例如:appName~serviceName。

--resource-group -g

指定资源组名称。 可以使用 az configure --defaults group=<name> 配置默认组。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。