应用程序升级参数Application upgrade parameters

本文介绍 Azure Service Fabric 应用程序升级期间应用的各种参数。This article describes the various parameters that apply during the upgrade of an Azure Service Fabric application. 应用程序升级参数控制升级期间应用的超时和运行状况检查,并指定在升级失败时必须应用的策略。Application upgrade parameters control the time-outs and health checks that are applied during the upgrade, and they specify the policies that must be applied when an upgrade fails. 应用程序参数使用以下项应用于升级:Application parameters apply to upgrades using:

  • PowerShellPowerShell
  • Visual StudioVisual Studio
  • SFCTLSFCTL
  • RESTREST

应用程序升级通过三个可供用户选择的升级模式中的一个进行启动。Application upgrades are initiated via one of three user-selectable upgrade modes. 每个模式都有自己的应用程序参数集:Each mode has its own set of application parameters:

  • MonitoredMonitored
  • 不受监视的自动Unmonitored Auto
  • 不受监视的手动Unmonitored Manual

每部分中都介绍了适用的必需和可选参数,如下所述。The applicable required and optional parameters are described in each section as follows.

Visual Studio 和 PowerShell 参数Visual Studio and PowerShell parameters

通过 PowerShell 进行的 Service Fabric 应用程序升级使用 Start-ServiceFabricApplicationUpgrade 命令。Service Fabric application upgrades using PowerShell use the Start-ServiceFabricApplicationUpgrade command. MonitoredUnmonitoredAutoUnmonitoredManual 参数传递给 Start-ServiceFabricApplicationUpgrade 即可选择升级模式。The upgrade mode is selected by passing either the Monitored, UnmonitoredAuto, or UnmonitoredManual parameter to Start-ServiceFabricApplicationUpgrade.

Visual Studio Service Fabric 应用程序升级参数通过“Visual Studio 升级设置”对话框进行设置。Visual Studio Service Fabric application upgrade parameters are set via the Visual Studio Upgrade Settings dialog. Visual Studio 升级模式通过“升级模式”下拉框从“Monitored”、“UnmonitoredAuto”或“UnmonitoredManual”中进行选择。 The Visual Studio upgrade mode is selected using the Upgrade Mode dropdown box to either Monitored, UnmonitoredAuto, or UnmonitoredManual. 有关详细信息,请参阅在 Visual Studio 中配置 Service Fabric 应用程序的升级For more information, see Configure the upgrade of a Service Fabric application in Visual Studio.

必需的参数Required parameters

(PS=PowerShell,VS=Visual Studio)(PS=PowerShell, VS=Visual Studio)

参数Parameter 应用于Applies To 说明Description
ApplicationNameApplicationName PSPS 正在升级的应用程序的名称。Name of the application that is being upgraded. 示例:fabric:/VisualObjects、fabric:/ClusterMonitor。Examples: fabric:/VisualObjects, fabric:/ClusterMonitor.
ApplicationTypeVersionApplicationTypeVersion PSPS 作为升级目标的应用程序类型版本。The version of the application type that the upgrade targets.
FailureActionFailureAction PS、VSPS, VS 允许的值为 RollbackManualInvalidAllowed values are Rollback, Manual, and Invalid. Monitored 升级遇到违反监视策略或运行状况策略的情况时需执行的补救操作。The compensating action to perform when a Monitored upgrade encounters monitoring policy or health policy violations.
Rollback 指定将升级自动回退到升级前的版本。Rollback specifies that the upgrade will automatically roll back to the pre-upgrade version.
Manual 指示将升级切换到 UnmonitoredManual 升级模式。Manual indicates that the upgrade will switch to the UnmonitoredManual upgrade mode.
Invalid 指示故障操作无效。Invalid indicates that the failure action is invalid.
MonitoredMonitored PSPS 指示升级模式为“受监视”。Indicates that the upgrade mode is monitored. 在 cmdlet 完成某个升级域的升级以后,如果该升级域和群集的运行状况符合定义的运行状况策略,则 Service Fabric 会升级下一个升级域。After the cmdlet finishes an upgrade for an upgrade domain, if the health of the upgrade domain and the cluster meet the health policies that you define, Service Fabric upgrades the next upgrade domain. 如果升级域或群集不满足运行状况策略,则升级失败,Service Fabric 会回退升级域的升级,或者会按指定策略回复到手动模式。If the upgrade domain or cluster fails to meet health policies, the upgrade fails and Service Fabric rolls back the upgrade for the upgrade domain or reverts to manual mode per the policy specified. 这是建议用于生产环境的应用程序升级模式。This is the recommended mode for application upgrades in a production environment.
UpgradeModeUpgradeMode VSVS 允许的值为 Monitored(默认)、UnmonitoredAutoUnmonitoredManualAllowed values are Monitored (default), UnmonitoredAuto, or UnmonitoredManual. 有关详细信息,请查看本文中每个模式的 PowerShell 参数。See PowerShell parameters for each mode in this article for details.
UnmonitoredAutoUnmonitoredAuto PSPS 指示升级模式为“不受监视的自动”。Indicates that the upgrade mode is unmonitored automatic. Service Fabric 在升级某个升级域以后,就会直接升级下一个升级域,而不管应用程序运行状况如何。After Service Fabric upgrades an upgrade domain, Service Fabric upgrades the next upgrade domain irrespective of the application health state. 不建议将此模式用于生产环境,它只适用于应用程序开发阶段。This mode is not recommended for production, and is only useful during development of an application.
UnmonitoredManualUnmonitoredManual PSPS 指示升级模式为“不受监视的手动”。Indicates that the upgrade mode is unmonitored manual. Service Fabric 在升级某个升级域以后,会等待你使用 Resume-ServiceFabricApplicationUpgrade cmdlet 升级下一个升级域。After Service Fabric upgrades an upgrade domain, it waits for you to upgrade the next upgrade domain by using the Resume-ServiceFabricApplicationUpgrade cmdlet.

可选参数Optional parameters

运行状况评估参数为可选参数。The health evaluation parameters are optional. 如果在启动升级时未指定运行状况评估条件,则 Service Fabric 将使用应用程序实例的 ApplicationManifest.xml 中指定的应用程序运行状况策略。If the health evaluation criteria are not specified when an upgrade starts, Service Fabric uses the application health policies specified in the ApplicationManifest.xml of the application instance.

参数Parameter 应用于Applies To 说明Description
ApplicationParameterApplicationParameter PS、VSPS, VS 指定应用程序参数的替代。Specifies the overrides for application parameters.
PowerShell 应用程序参数指定为哈希表名称/值对。PowerShell application parameters are specified as hashtable name/value pairs. 例如,@{ "VotingData_MinReplicaSetSize" = "3"; "VotingData_PartitionCount" = "1" }。For example, @{ "VotingData_MinReplicaSetSize" = "3"; "VotingData_PartitionCount" = "1" }.
Visual Studio 应用程序参数可以在“发布 Service Fabric 应用程序”对话框的“应用程序参数文件”字段中指定。 Visual Studio application parameters can be specified in the Publish Service Fabric Application dialog in the Application Parameters File field.
确认Confirm PSPS 允许的值为 TrueFalseAllowed values are True and False. 提示你在运行 cmdlet 之前进行确认。Prompts for confirmation before running the cmdlet.
ConsiderWarningAsErrorConsiderWarningAsError PS、VSPS, VS 允许的值为 TrueFalseAllowed values are True and False. 默认值为 FalseDefault value is False. 在升级期间评估应用程序的运行状况时,将应用程序的警告运行状况事件视为错误。Treat the warning health events for the application as errors when evaluating the health of the application during upgrade. 默认情况下,Service Fabric 不会将警告运行状况事件评估为失败(错误),因此即使存在警告事件,升级也可以继续。By default, Service Fabric does not evaluate warning health events to be failures (errors), so the upgrade can proceed even if there are warning events.
DefaultServiceTypeHealthPolicyDefaultServiceTypeHealthPolicy PS、VSPS, VS 以 MaxPercentUnhealthyPartitionsPerService、MaxPercentUnhealthyReplicasPerPartition、MaxPercentUnhealthyServices 格式指定用于受监视升级的默认服务类型的运行状况策略。Specifies the health policy for the default service type to use for the monitored upgrade in the format MaxPercentUnhealthyPartitionsPerService, MaxPercentUnhealthyReplicasPerPartition, MaxPercentUnhealthyServices. 例如,5,10,15 指示以下值:MaxPercentUnhealthyPartitionsPerService = 5,MaxPercentUnhealthyReplicasPerPartition = 10,MaxPercentUnhealthyServices = 15。For example, 5,10,15 indicates the following values: MaxPercentUnhealthyPartitionsPerService = 5, MaxPercentUnhealthyReplicasPerPartition = 10, MaxPercentUnhealthyServices = 15.
ForceForce PS、VSPS, VS 允许的值为 TrueFalseAllowed values are True and False. 指示升级过程将跳过警告消息并强制升级,即使在版本号不变的情况下也是如此。Indicates that the upgrade process skips the warning message and forces the upgrade even when the version number hasn't changed. 这适用于本地测试,但不建议用于生产环境,因为它要求删除现有的部署,导致停机和可能的数据丢失。This is useful for local testing but is not recommended for use in a production environment as it requires removing the existing deployment which causes down-time and potential data loss.
ForceRestartForceRestart PS、VSPS, VS 如果更新配置或数据包而不更新服务代码,则仅当 ForceRestart 属性设置为 True 时,服务才会重启。If you update a configuration or data package without updating the service code, the service is restarted only if the ForceRestart property is set to True. 更新完成后,Service Fabric 将通知服务新的配置包或数据包可用。When the update is complete, Service Fabric notifies the service that a new configuration package or data package is available. 该服务负责应用所做的更改。The service is responsible for applying the changes. 如有必要,该服务可进行重启。If necessary, the service can restart itself.
HealthCheckRetryTimeoutSecHealthCheckRetryTimeoutSec PS、VSPS, VS 声明升级失败之前,Service Fabric 继续执行运行状况评估的持续时间(以秒为单位)。The duration (in seconds) that Service Fabric continues to perform health evaluation before declaring the upgrade as failed. 默认为 600 秒。The default is 600 seconds. 此持续时间在 HealthCheckWaitDurationSec 秒后开始。This duration starts after HealthCheckWaitDurationSec is reached. 在此 HealthCheckRetryTimeout 期间,Service Fabric 可能会对应用程序执行多次运行状况检查。Within this HealthCheckRetryTimeout, Service Fabric might perform multiple health checks of the application health. 默认值为 10 分钟,应该针对应用程序相应地自定义该值。The default value is 10 minutes and should be customized appropriately for your application.
HealthCheckStableDurationSecHealthCheckStableDurationSec PS、VSPS, VS 在转到下一个升级域或完成升级之前,为了验证应用程序是否稳定而要等待的持续时间(以秒为单位)。The duration (in seconds) to verify that the application is stable before moving to the next upgrade domain or completing the upgrade. 此等待持续时间用于防止在执行了运行状况检查后,未检测到运行状况更改。This wait duration is used to prevent undetected changes of health right after the health check is performed. 默认值为 120 秒,应该针对应用程序相应地自定义该值。The default value is 120 seconds, and should be customized appropriately for your application.
HealthCheckWaitDurationSecHealthCheckWaitDurationSec PS、VSPS, VS 完成升级域的升级后,在 Service Fabric 评估应用程序的运行状况之前需要等待的时间(以秒为单位)。The time to wait (in seconds) after the upgrade has finished on the upgrade domain before Service Fabric evaluates the health of the application. 也可将此持续时间视为应用程序应先运行多长时间才可被视为正常运行。This duration can also be considered as the time an application should be running before it can be considered healthy. 如果运行状况检查通过,升级过程将转到下一个升级域。If the health check passes, the upgrade process proceeds to the next upgrade domain. 如果运行状况检查失败,则在再次重试运行状况检查之前,Service Fabric 会等待 UpgradeHealthCheckInterval 秒的时间,直到 HealthCheckRetryTimeoutSec 秒的时间用完。If the health check fails, Service Fabric waits for UpgradeHealthCheckInterval before retrying the health check again until the HealthCheckRetryTimeoutSec is reached. 建议的默认值为 0 秒。The default and recommended value is 0 seconds.
MaxPercentUnhealthyDeployedApplicationsMaxPercentUnhealthyDeployedApplications PS、VSPS, VS 建议的默认值为 0。Default and recommended value is 0. 指定在将应用程序视为不正常和升级失败之前,可以不正常的最大已部署应用程序数(请参阅运行状况部分)。Specify the maximum number of deployed applications (see the Health section) that can be unhealthy before the application is considered unhealthy and fails the upgrade. 此参数在节点上定义应用程序运行状况,可帮助检查升级过程中的问题。This parameter defines the application health on the node and helps detect issues during upgrade. 通常,应用程序的副本将与另一个节点负载均衡,使应用程序看上去运行正常,从而使升级继续。Typically, the replicas of the application get load-balanced to the other node, which allows the application to appear healthy, thus allowing the upgrade to proceed. 通过指定严格的 MaxPercentUnhealthyDeployedApplications 运行状况,Service Fabric 可以快速检测应用程序包的问题,这样就产生了一种采用快速失败机制的升级。By specifying a strict MaxPercentUnhealthyDeployedApplications health, Service Fabric can detect a problem with the application package quickly and help produce a fail fast upgrade.
MaxPercentUnhealthyServicesMaxPercentUnhealthyServices PS、VSPS, VS DefaultServiceTypeHealthPolicyServiceTypeHealthPolicyMap 的参数。A parameter to DefaultServiceTypeHealthPolicy and ServiceTypeHealthPolicyMap. 建议的默认值为 0。Default and recommended value is 0. 指定在将应用程序视为不正常和升级失败之前,应用程序实例中可以不正常的最大服务数。Specify the maximum number of services in the application instance that can be unhealthy before the application is considered unhealthy and fails the upgrade.
MaxPercentUnhealthyPartitionsPerServiceMaxPercentUnhealthyPartitionsPerService PS、VSPS, VS DefaultServiceTypeHealthPolicyServiceTypeHealthPolicyMap 的参数。A parameter to DefaultServiceTypeHealthPolicy and ServiceTypeHealthPolicyMap. 建议的默认值为 0。Default and recommended value is 0. 指定在将服务视为不正常之前,服务中可以不正常的最大分区数。Specify the maximum number of partitions in a service that can be unhealthy before the service is considered unhealthy.
MaxPercentUnhealthyReplicasPerPartitionMaxPercentUnhealthyReplicasPerPartition PS、VSPS, VS DefaultServiceTypeHealthPolicyServiceTypeHealthPolicyMap 的参数。A parameter to DefaultServiceTypeHealthPolicy and ServiceTypeHealthPolicyMap. 建议的默认值为 0。Default and recommended value is 0. 指定在将分区视为不正常之前,分区中不正常的最大副本数。Specify the maximum number of replicas in partition that can be unhealthy before the partition is considered unhealthy.
ServiceTypeHealthPolicyMapServiceTypeHealthPolicyMap PS、VSPS, VS 代表的运行状况策略用于评估属于某个服务类型的服务的运行状况。Represents the health policy used to evaluate the health of services belonging to a service type. 采用以下格式的哈希表输入:@ {"ServiceTypeName" : "MaxPercentUnhealthyPartitionsPerService,MaxPercentUnhealthyReplicasPerPartition,MaxPercentUnhealthyServices"} 例如:@{ "ServiceTypeName01" = "5,10,5"; "ServiceTypeName02" = "5,5,5" }Takes a hash table input in the following format: @ {"ServiceTypeName" : "MaxPercentUnhealthyPartitionsPerService,MaxPercentUnhealthyReplicasPerPartition,MaxPercentUnhealthyServices"} For example: @{ "ServiceTypeName01" = "5,10,5"; "ServiceTypeName02" = "5,5,5" }
TimeoutSecTimeoutSec PS、VSPS, VS 指定操作的超时设置(以秒为单位)。Specifies the time-out period in seconds for the operation.
UpgradeDomainTimeoutSecUpgradeDomainTimeoutSec PS、VSPS, VS 升级单个升级域的最长时间(以秒为单位)。Maximum time (in seconds) for upgrading a single upgrade domain. 如果达到了此超时限制,升级会停止,然后根据 FailureAction 的设置继续。If this time-out is reached, the upgrade stops and proceeds based on the setting for FailureAction. 默认值为 never(无期限),应该针对应用程序相应地自定义该值。The default value is never (Infinite) and should be customized appropriately for your application.
UpgradeReplicaSetCheckTimeoutSecUpgradeReplicaSetCheckTimeoutSec PS、VSPS, VS 以秒为度量单位。Measured in seconds.
无状态服务 - 在单个升级域内,Service Fabric 尝试确保服务的其他实例可用。Stateless service--Within a single upgrade domain, Service Fabric tries to ensure that additional instances of the service are available. 如果有多个目标实例,则 Service Fabric 等待多个实例可用,直到达到最大超时值。If the target instance count is more than one, Service Fabric waits for more than one instance to be available, up to a maximum time-out value. 此超时使用 UpgradeReplicaSetCheckTimeoutSec 属性指定。This time-out is specified by using the UpgradeReplicaSetCheckTimeoutSec property. 如果超时到期,Service Fabric 将继续进行升级,而无论服务实例的数量。If the time-out expires, Service Fabric proceeds with the upgrade, regardless of the number of service instances. 如果只有一个目标实例,则 Service Fabric 不会等待,而是会立即继续进行升级。If the target instance count is one, Service Fabric does not wait, and immediately proceeds with the upgrade.

有状态服务 - 在单个升级域内,Service Fabric 尝试确保副本集具有仲裁。Stateful service--Within a single upgrade domain, Service Fabric tries to ensure that the replica set has a quorum. Service Fabric 会等待可用的仲裁,直到达到最大超时值(由 UpgradeReplicaSetCheckTimeoutSec 属性指定)。Service Fabric waits for a quorum to be available, up to a maximum time-out value (specified by the UpgradeReplicaSetCheckTimeoutSec property). 如果超时到期,Service Fabric 将继续进行升级,而无论是否具有仲裁。If the time-out expires, Service Fabric proceeds with the upgrade, regardless of quorum. 前滚时,此设置设置为 never(无限);回退时,设置为 1200 秒。This setting is set as never (infinite) when rolling forward, and 1200 seconds when rolling back.
UpgradeTimeoutSecUpgradeTimeoutSec PS、VSPS, VS 应用于整个升级的超时(以秒为单位)。A time-out (in seconds) that applies for the entire upgrade. 如果达到了此超时限制,则升级会停止,并会触发 FailureActionIf this time-out is reached, the upgrade stops and FailureAction is triggered. 默认值为 never(无期限),应该针对应用程序相应地自定义该值。The default value is never (Infinite) and should be customized appropriately for your application.
WhatIfWhatIf PSPS 允许的值为 TrueFalseAllowed values are True and False. 显示在此 cmdlet 运行的情况下将会发生什么。Shows what would happen if the cmdlet runs. 此 cmdlet 未运行。The cmdlet is not run.

MaxPercentUnhealthyServicesMaxPercentUnhealthyPartitionsPerServiceMaxPercentUnhealthyReplicasPerPartition 条件可按照应用程序实例的服务类型进行指定。The MaxPercentUnhealthyServices, MaxPercentUnhealthyPartitionsPerService, and MaxPercentUnhealthyReplicasPerPartition criteria can be specified per service type for an application instance. 为每个服务设置这些参数可让应用程序包含不同评估策略的不同服务类型。Setting these parameters per-service allows for an application to contain different services types with different evaluation policies. 例如,无状态网关服务类型可以有一个 MaxPercentUnhealthyPartitionsPerService,它不同于特定应用程序实例的有状态引擎服务类型。For example, a stateless gateway service type can have a MaxPercentUnhealthyPartitionsPerService that is different from a stateful engine service type for a particular application instance.

SFCTL 参数SFCTL parameters

通过 Service Fabric CLI 进行的 Service Fabric 应用程序升级使用 sfctl application upgrade 命令以及下面的必需和可选参数。Service Fabric application upgrades using the Service Fabric CLI use the sfctl application upgrade command along with the following required and optional parameters.

必需的参数Required parameters

参数Parameter 说明Description
application-idapplication-id 要升级的应用程序的 ID。ID of the application that is being upgraded.
这通常是不带“fabric:”URI 方案的应用程序全名。This is typically the full name of the application without the 'fabric:' URI scheme. 从版本 6.0 开始,分层名称以“~”字符隔开。Starting from version 6.0, hierarchical names are delimited with the '~' character. 例如,如果应用程序名称为“fabric:/myapp/app1”,则 6.0 及更高版本中的应用程序标识为“myapp~app1”,在以前的版本中为“myapp/app1”。For example, if the application name is 'fabric:/myapp/app1', the application identity would be 'myapp~app1' in 6.0+ and 'myapp/app1' in previous versions.
application-versionapplication-version 作为升级目标的应用程序类型版本。The version of the application type that the upgrade targets.
parametersparameters 升级应用程序时应用的应用程序参数替代的 JSON 编码列表。A JSON encoded list of application parameter overrides to be applied when upgrading the application.

可选参数Optional parameters

参数Parameter 说明Description
default-service-health-policydefault-service-health-policy 默认使用的健康策略的 JSON 编码规范,用于评估服务类型的运行状况。JSON encoded specification of the health policy used by default to evaluate the health of a service type. 映射默认为空。The map is empty by default.
failure-actionfailure-action 允许的值为 RollbackManualInvalidAllowed values are Rollback, Manual, and Invalid. Monitored 升级遇到违反监视策略或运行状况策略的情况时需执行的补救操作。The compensating action to perform when a Monitored upgrade encounters monitoring policy or health policy violations.
Rollback 指定将升级自动回退到升级前的版本。Rollback specifies that the upgrade will automatically roll back to the pre-upgrade version.
Manual 指示将升级切换到 UnmonitoredManual 升级模式。Manual indicates that the upgrade will switch to the UnmonitoredManual upgrade mode.
Invalid 指示故障操作无效。Invalid indicates that the failure action is invalid.
force-restartforce-restart 如果更新配置或数据包而不更新服务代码,则仅当 ForceRestart 属性设置为 True 时,服务才会重启。If you update a configuration or data package without updating the service code, the service is restarted only if the ForceRestart property is set to True. 更新完成后,Service Fabric 将通知服务新的配置包或数据包可用。When the update is complete, Service Fabric notifies the service that a new configuration package or data package is available. 该服务负责应用所做的更改。The service is responsible for applying the changes. 如有必要,该服务可进行重启。If necessary, the service can restart itself.
health-check-retry-timeouthealth-check-retry-timeout 执行 FailureAction 前,当应用程序或群集不正常时,重试运行状况评估所需的时间。The amount of time to retry health evaluation when the application or cluster is unhealthy before FailureAction is executed. 首先,会将其解释为表示 ISO 8601 持续时间的一个字符串。It is first interpreted as a string representing an ISO 8601 duration. 如果那失败,则会将其解释为表示总毫秒数的一个数字。If that fails, then it is interpreted as a number representing the total number of milliseconds. 默认值:PT0H10M0S。Default: PT0H10M0S.
health-check-stable-durationhealth-check-stable-duration 升级继续到下一升级域之前,应用程序或群集必须保持正常的时长。The amount of time that the application or cluster must remain healthy before the upgrade proceeds to the next upgrade domain. 首先,会将其解释为表示 ISO 8601 持续时间的一个字符串。It is first interpreted as a string representing an ISO 8601 duration. 如果那失败,则会将其解释为表示总毫秒数的一个数字。If that fails, then it is interpreted as a number representing the total number of milliseconds. 默认值:PT0H2M0S。Default: PT0H2M0S.
health-check-wait-durationhealth-check-wait-duration 应用运行状况策略之前,完成升级域后等待的时间长度。The amount of time to wait after completing an upgrade domain before applying health policies. 首先,会将其解释为表示 ISO 8601 持续时间的一个字符串。It is first interpreted as a string representing an ISO 8601 duration. 如果那失败,则会将其解释为表示总毫秒数的一个数字。If that fails, then it is interpreted as a number representing the total number of milliseconds. 默认值:0。Default: 0.
max-unhealthy-appsmax-unhealthy-apps 建议的默认值为 0。Default and recommended value is 0. 指定在将应用程序视为不正常和升级失败之前,可以不正常的最大已部署应用程序数(请参阅运行状况部分)。Specify the maximum number of deployed applications (see the Health section) that can be unhealthy before the application is considered unhealthy and fails the upgrade. 此参数在节点上定义应用程序运行状况,可帮助检查升级过程中的问题。This parameter defines the application health on the node and helps detect issues during upgrade. 通常,应用程序的副本将与另一个节点负载均衡,使应用程序看上去运行正常,从而使升级继续。Typically, the replicas of the application get load-balanced to the other node, which allows the application to appear healthy, thus allowing the upgrade to proceed. 通过指定严格的 max-unhealthy-apps 运行状况,Service Fabric 可以快速检测应用程序包的问题,这样就产生了一种采用快速失败机制的升级。By specifying a strict max-unhealthy-apps health, Service Fabric can detect a problem with the application package quickly and help produce a fail fast upgrade. 由介于 0 到 100 间的数字表示。Represented as a number between 0 and 100.
modemode 允许的值为 MonitoredUpgradeModeUnmonitoredAutoUnmonitoredManualAllowed values are Monitored, UpgradeMode, UnmonitoredAuto, UnmonitoredManual. 默认值为 UnmonitoredAutoDefault is UnmonitoredAuto. 有关这些值的说明,请参阅 Visual Studio 和 PowerShell 必需的参数部分。See the Visual Studio and PowerShell Required Parameters section for descriptions of these values.
replica-set-check-timeoutreplica-set-check-timeout 以秒为度量单位。Measured in seconds.
无状态服务 - 在单个升级域内,Service Fabric 尝试确保服务的其他实例可用。Stateless service--Within a single upgrade domain, Service Fabric tries to ensure that additional instances of the service are available. 如果有多个目标实例,则 Service Fabric 等待多个实例可用,直到达到最大超时值。If the target instance count is more than one, Service Fabric waits for more than one instance to be available, up to a maximum time-out value. 此超时是使用 replica-set-check-timeout 属性指定的。This time-out is specified by using the replica-set-check-timeout property. 如果超时到期,Service Fabric 将继续进行升级,而无论服务实例的数量。If the time-out expires, Service Fabric proceeds with the upgrade, regardless of the number of service instances. 如果只有一个目标实例,则 Service Fabric 不会等待,而是会立即继续进行升级。If the target instance count is one, Service Fabric does not wait, and immediately proceeds with the upgrade.

有状态服务 - 在单个升级域内,Service Fabric 尝试确保副本集具有仲裁。Stateful service--Within a single upgrade domain, Service Fabric tries to ensure that the replica set has a quorum. Service Fabric 将等待一个仲裁可用,直到达到最大超时值(由 replica-set-check-timeout 属性指定)。Service Fabric waits for a quorum to be available, up to a maximum time-out value (specified by the replica-set-check-timeout property). 如果超时到期,Service Fabric 将继续进行升级,而无论是否具有仲裁。If the time-out expires, Service Fabric proceeds with the upgrade, regardless of quorum. 前滚时,此设置设置为 never(无限);回退时,设置为 1200 秒。This setting is set as never (infinite) when rolling forward, and 1200 seconds when rolling back.
service-health-policyservice-health-policy 包含每个服务类型名称的服务类型健康策略的 JSON 编码映射。JSON encoded map with service type health policy per service type name. 映射默认为空。The map is empty be default. 参数 JSON 格式。Parameter JSON format.. “Value”部分的 JSON 包含 MaxPercentUnhealthyServicesMaxPercentUnhealthyPartitionsPerServiceMaxPercentUnhealthyReplicasPerPartitionThe JSON for the "Value" portion contains MaxPercentUnhealthyServices, MaxPercentUnhealthyPartitionsPerService, and MaxPercentUnhealthyReplicasPerPartition. 有关这些参数的说明,请参阅 Visual Studio 和 PowerShell “可选参数”部分。See the Visual Studio and PowerShell Optional Parameters section for descriptions of these parameters.
timeouttimeout 指定操作的超时设置(以秒为单位)。Specifies the time-out period in seconds for the operation. 默认值:60。Default: 60.
upgrade-domain-timeoutupgrade-domain-timeout 执行 FailureAction 前,每个升级域需等待的时长。The amount of time each upgrade domain has to complete before FailureAction is executed. 首先,会将其解释为表示 ISO 8601 持续时间的一个字符串。It is first interpreted as a string representing an ISO 8601 duration. 如果那失败,则会将其解释为表示总毫秒数的一个数字。If that fails, then it is interpreted as a number representing the total number of milliseconds. 默认值为 never(无期限),应该针对应用程序相应地自定义该值。The default value is never (Infinite) and should be customized appropriately for your application. 默认值:P10675199DT02H48M05.4775807S。Default: P10675199DT02H48M05.4775807S.
upgrade-timeoutupgrade-timeout 执行 FailureAction 前,每个升级域需等待的时长。The amount of time each upgrade domain has to complete before FailureAction is executed. 首先,会将其解释为表示 ISO 8601 持续时间的一个字符串。It is first interpreted as a string representing an ISO 8601 duration. 如果那失败,则会将其解释为表示总毫秒数的一个数字。If that fails, then it is interpreted as a number representing the total number of milliseconds. 默认值为 never(无期限),应该针对应用程序相应地自定义该值。The default value is never (Infinite) and should be customized appropriately for your application. 默认值:P10675199DT02H48M05.4775807S。Default: P10675199DT02H48M05.4775807S.
warning-as-errorwarning-as-error 允许的值为 TrueFalseAllowed values are True and False. 默认值为 FalseDefault value is False. 可以作为标记进行传递。Can be passed in as a flag. 在升级期间评估应用程序的运行状况时,将应用程序的警告运行状况事件视为错误。Treat the warning health events for the application as errors when evaluating the health of the application during upgrade. 默认情况下,Service Fabric 不会将警告运行状况事件评估为失败(错误),因此即使存在警告事件,升级也可以继续。By default, Service Fabric does not evaluate warning health events to be failures (errors), so the upgrade can proceed even if there are warning events.

后续步骤Next steps

使用 Visual Studio 升级应用程序逐步讲解了如何使用 Visual Studio 进行应用程序升级。Upgrading your Application Using Visual Studio walks you through an application upgrade using Visual Studio.

使用 Powershell 升级应用程序逐步讲解了如何使用 PowerShell 进行应用程序升级。Upgrading your Application Using Powershell walks you through an application upgrade using PowerShell.

在 Linux 上使用 Service Fabric CLI 升级应用程序介绍如何使用 Service Fabric CLI 完成应用程序升级。Upgrading your Application using Service Fabric CLI on Linux walks you through an application upgrade using Service Fabric CLI.

使用 Service Fabric Eclipse 插件升级应用程序Upgrading your application using Service Fabric Eclipse Plugin

了解如何使用数据序列化,使应用程序在升级后保持兼容。Make your application upgrades compatible by learning how to use Data Serialization.

参考高级主题,了解如何在升级应用程序时使用高级功能。Learn how to use advanced functionality while upgrading your application by referring to Advanced Topics.

参考对应用程序升级进行故障排除中的步骤来解决应用程序升级时的常见问题。Fix common problems in application upgrades by referring to the steps in Troubleshooting Application Upgrades.