Share via


Update-ServiceFabricService

Updates a Service Fabric service.

Syntax

Stateless (Default)

Update-ServiceFabricService
    [-ServiceName] <Uri>
    [-Stateless]
    [-InstanceCount <Int32>]
    [-MinInstanceCount <Int32>]
    [-MinInstancePercentage <Int32>]
    [-InstanceLifecycleDescription <InstanceLifecycleDescription>]
    [-Force]
    [-PlacementConstraints <String>]
    [-Metric <String[]>]
    [-Correlation <String[]>]
    [-PlacementPolicy <String[]>]
    [-DefaultMoveCost <String>]
    [-PartitionNamesToAdd <String[]>]
    [-PartitionNamesToRemove <String[]>]
    [-ScalingPolicies <System.Collections.Generic.List`1[System.Fabric.Description.ScalingPolicyDescription]>]
    [-InstanceCloseDelayDuration <TimeSpan>]
    [-InstanceRestartWaitDuration <TimeSpan>]
    [-ServiceDnsName <String>]
    [-TagsRequiredToPlace <System.Collections.Generic.List`1[System.String]>]
    [-TagsRequiredToRun <System.Collections.Generic.List`1[System.String]>]
    [-TimeoutSec <Int32>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Stateful

Update-ServiceFabricService
    [-ServiceName] <Uri>
    [-Stateful]
    [-TargetReplicaSetSize <Int32>]
    [-MinReplicaSetSize <Int32>]
    [-ReplicaRestartWaitDuration <TimeSpan>]
    [-QuorumLossWaitDuration <TimeSpan>]
    [-StandByReplicaKeepDuration <TimeSpan>]
    [-ServicePlacementTimeLimit <TimeSpan>]
    [-DropSourceReplicaOnMove <Boolean>]
    [-ReplicaLifecycleDescription <ReplicaLifecycleDescription>]
    [-Force]
    [-PlacementConstraints <String>]
    [-Metric <String[]>]
    [-Correlation <String[]>]
    [-PlacementPolicy <String[]>]
    [-DefaultMoveCost <String>]
    [-PartitionNamesToAdd <String[]>]
    [-PartitionNamesToRemove <String[]>]
    [-ScalingPolicies <System.Collections.Generic.List`1[System.Fabric.Description.ScalingPolicyDescription]>]
    [-ServiceDnsName <String>]
    [-TagsRequiredToPlace <System.Collections.Generic.List`1[System.String]>]
    [-TagsRequiredToRun <System.Collections.Generic.List`1[System.String]>]
    [-TimeoutSec <Int32>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Update-ServiceFabricService cmdlet updates properties of a running Service Fabric service. The set of properties that can be updated are a subset of the properties that were specified at the time of creating the service (using New-ServiceFabricService or New-ServiceFabricServiceFromTemplate). You can get current properties of your service using Get-ServiceFabricServiceDescription.

Please note that updating the properties of a running service is different than upgrading your service using Start-ServiceFabricApplicationUpgrade.Upgrading your service (i.e. application) is a long running background task that involves moving your application, from one version to another, one upgrade domain at a time. Please see Service Fabric Application Upgrade for more details.

Before you perform any operation on a Service Fabric cluster, establish a connection to the cluster by using the Connect-ServiceFabricCluster cmdlet.

Examples

Example 1: Update a stateful service

PS C:\> Update-ServiceFabricService -Stateful fabric:/myapp/test -MinReplicaSetSize 3 -TargetReplicaSetSize 5

This command updates the MinReplicaSetSize and TargetReplicaSetSize of a running Fabric Service to three (3) and five (5).

Example 2: Update a stateless service

PS C:\> Update-ServiceFabricService -Stateless fabric:/myapp/test -InstanceCount -1

This command updates the instance count of a running Fabric Service to a value of -1.

Example 3: Update placement constraints

PS C:\> Update-ServiceabricService -Stateless -ServiceName fabric:/myapp/test -PlacementConstraints "NodeName!=NodeBar"

This command updates the placement constraints.

Example 4: Update default load metrics

PS C:\> Update-ServiceFabricService -Stateless -ServiceName fabric:/myapp/test -Metric @("CPU,High,10")
PS C:\> Update-ServiceFabricService -Stateful -ServiceName fabric:/myapp/test -Metric @("CPU,High,10,1")

The first command updates the default load metrics for a stateless service.

The second command updates the default load metrics for a stateful service.

Example 5: Update placement policy

PS C:\> Update-ServiceFabricService -Stateful -ServiceName fabric:/myapp/test -PlacementPolicy @("InvalidDomain,fd:/dc2/rack2")

This command updates the placement policy.

Example 6: Update service correlation

PS C:\> Update-ServiceFabricService -Stateful -ServiceName fabric:/myapp/test -Correlation @("fabric:/app/test2,AlignedAffinity")

This command updates the service correlation.

Example 7: Update service DNS name

PS C:\> Update-ServiceFabricService -Stateful -ServiceName fabric:/myapp/test -ServiceDnsName stateful.dns
PS C:\> Update-ServiceFabricService -Stateless -ServiceName fabric:/myapp/test -ServiceDnsName stateless.dns

This command updates the service DNS name of a service. Note : If the updated DNS name has already been queried on the cluster or the updating service already had a DNS name, DNS service should be restarted after the update to invalidate the cache.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Correlation

Specifies an updated array of correlation constraints for this service. To learn more about service correlation, see Configuring and using service affinity in Service Fabric.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultMoveCost

Specifies the updated default move cost that replicas have when they are created. The acceptable values for this parameter are:

  • Zero
  • Low
  • Medium
  • High

For more details about move cost, see Service movement cost for influencing Cluster Resource Manager choices.

Parameter properties

Type:String
Default value:None
Accepted values:Zero, Low, Medium, High, VeryHigh
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DropSourceReplicaOnMove

Enables source Secondary replicas to be dropped before new Secondary replicas finish the build.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Stateful
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Force

Forces the command to run without asking for user confirmation.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InstanceCloseDelayDuration

Specifies the duration in seconds, to wait before a stateless instance which is impacted by application upgrade is closed, to allow the active requests to drain gracefully. This wait duration is effective only for the instances of those stateless services which have a non-zero value configured for the InstanceCloseDelayDuration, and will override the pre-configured value. See InstanceCloseDelayDuration for details. Do not specify this parameter for stateful services.

Parameter properties

Type:TimeSpan
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Stateless
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InstanceCount

Specifies the updated number of instances for the Service Fabric stateless service. Do not specify this parameter for stateful services.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Stateless
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InstanceLifecycleDescription

Lifecycle description of instances belonging to this service. If some configuration in this section is not specified, the default value is taken from the cluster parameter of the same name (if existing).

Parameter properties

Type:InstanceLifecycleDescription
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Stateless
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InstanceRestartWaitDuration

When a stateless instance goes down, this timer starts. When it expires Service Fabric will create a new instance on any node in the cluster. This configuration is to reduce unnecessary creation of a new instance in situations where the instance going down is likely to recover in a short time. For example, during an upgrade. The default value is 0, which indicates that when stateless instance goes down, Service Fabric will immediately start building its replacement.

Parameter properties

Type:TimeSpan
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Stateless
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Metric

Specifies the updated array of metrics that the service reports. To learn more about metrics, see Managing resource consumption and load in Service Fabric with metrics.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MinInstanceCount

Specifies the updated minimum number of instances of the stateless service partition. See MinInstanceCount (in New-ServiceFabricService) for details. Do not specify this parameter for stateful services.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Stateless
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MinInstancePercentage

Specifies the updated minimum percentage of InstanceCount of a stateless service partition. See MinInstancePercentage (in New-ServiceFabricService) for details. Do not specify this parameter for stateful services.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Stateless
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MinReplicaSetSize

Specifies the updated minimum replica set size for the Service Fabric stateful service. The value must be less than the TargetReplicaSetSize of this service. For more details, see StatefulServiceDescription.MinReplicaSetSize.

Do not specify this parameter for stateless services.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Stateful
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PartitionNamesToAdd

{{Fill PartitionNamesToAdd Description}}

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PartitionNamesToRemove

{{Fill PartitionNamesToRemove Description}}

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PlacementConstraints

Specifies the updated placement constraint for the service. To learn more about placement constraints, see Placement constraints and node properties.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PlacementPolicy

Specifies an updated array of placement policies for a service. To learn more about PlacementPolicy, see Placement policies for service fabric services.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-QuorumLossWaitDuration

Specifies the updated duration, as a TimeSpan object, that Service Fabric waits before it declares data loss for a service partition.

To obtain a TimeSpan object, use the New-TimeSpan cmdlet. For more information, type Get-Help New-TimeSpan.

To learn more about the QuorumLossWaitDuration parameter, see StatefulServiceDescription.QuorumLossWaitDuration.

Parameter properties

Type:TimeSpan
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Stateful
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ReplicaLifecycleDescription

Lifecycle description of replicas belonging to this service. If some configuration in this section is not specified, the default value is taken from the cluster parameter of the same name (if existing).

Parameter properties

Type:ReplicaLifecycleDescription
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Stateful
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ReplicaRestartWaitDuration

Specifies the updated interval, as a TimeSpan object, that Service Fabric waits for the replica to restart before it creates a replacement replica. To obtain a TimeSpan object, use the New-TimeSpan cmdlet.

To learn more about QuorumLossWaitDuration, see StatefulServiceDescription.ReplicaRestartWaitDuration.

Parameter properties

Type:TimeSpan
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Stateful
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ScalingPolicies

{{Fill ScalingPolicies Description}}

Parameter properties

Type:

System.Collections.Generic.List`1[System.Fabric.Description.ScalingPolicyDescription]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ServiceDnsName

Specifies the updated DNS name of a service.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ServiceName

Specifies the URI of a Service Fabric service whose properties need to be updated.

Parameter properties

Type:Uri
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ServicePlacementTimeLimit

Sets the service placement time limit.

Parameter properties

Type:TimeSpan
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Stateful
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-StandByReplicaKeepDuration

Specifies the updated stand-by replica keep duration as a TimeSpan object.

To learn more about QuorumLossWaitDuration, see StatefulServiceDescription.StandByReplicaKeepDuration.

Parameter properties

Type:TimeSpan
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Stateful
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Stateful

Indicates that the service is a Service Fabric stateful service.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Stateful
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Stateless

Indicates that the service is a Service Fabric stateless service.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Stateless
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TagsRequiredToPlace

Declares tags required for placement of a service. Useful for dynamically influencing service placement. For more information, see Service Fabric Dynamic Node Tags.

Parameter properties

Type:

System.Collections.Generic.List`1[System.String]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TagsRequiredToRun

Declares tags required for placement and running of a service. Useful for dynamically influencing service placement and running. For more information, see Service Fabric Dynamic Node Tags

Parameter properties

Type:

System.Collections.Generic.List`1[System.String]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TargetReplicaSetSize

Specifies the updated target replica set size for a Service Fabric stateful service. For more details, see StatefulServiceDescription.TargetReplicaSetSize.

Do not specify this parameter for a stateless service.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Stateful
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TimeoutSec

Specifies the time-out period, in seconds, for the operation.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

System.Uri

Outputs

System.Object