Update-​Service​Fabric​Service

Updates a Service Fabric service.

Syntax

Update-ServiceFabricService
      [-Stateless]
      [-ServiceName] <Uri>
      [-Correlation <String[]>]
      [-DefaultMoveCost <String>]
      [-Force]
      [-InstanceCount <Int32>]
      [-Metric <String[]>]
      [-PlacementConstraints <String>]
      [-PlacementPolicy <String[]>]
      [-TimeoutSec <Int32>]
      [-Confirm]
      [-WhatIf]
      [<CommonParameters>]
Update-ServiceFabricService
      [-Stateful]
      [-ServiceName] <Uri>
      [-Correlation <String[]>]
      [-DefaultMoveCost <String>]
      [-Force]
      [-Metric <String[]>]
      [-MinReplicaSetSize <Int32>]
      [-PlacementConstraints <String>]
      [-PlacementPolicy <String[]>]
      [-QuorumLossWaitDuration <TimeSpan>]
      [-ReplicaRestartWaitDuration <TimeSpan>]
      [-StandByReplicaKeepDuration <TimeSpan>]
      [-TargetReplicaSetSize <Int32>]
      [-TimeoutSec <Int32>]
      [-Confirm]
      [-WhatIf]
      [<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.

Required Parameters

-ServiceName

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

Type:Uri
Position:2
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Stateful

Indicates that the service is a Service Fabric stateful service.

Type:SwitchParameter
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Stateless

Indicates that the service is a Service Fabric stateless service.

Type:SwitchParameter
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Optional Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-Correlation

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

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DefaultMoveCost

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

Type:String
Parameter Sets:Zero, Low, Medium, High
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Force

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InstanceCount

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

Type:Int32
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Metric

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

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters: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, please see StatefulServiceDescription.MinReplicaSetSizeDo not specify this parameter for stateless services.

Type:Int32
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PlacementConstraints

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

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PlacementPolicy

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

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters: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, please see StatefulServiceDescription.QuorumLossWaitDuration.

Type:TimeSpan
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters: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, please see StatefulServiceDescription.ReplicaRestartWaitDuration

Type:TimeSpan
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-StandByReplicaKeepDuration

Specifies the updated stand-by replica keep duration as a TimeSpan object.To learn more about QuorumLossWaitDuration, please see StatefulServiceDescription.StandByReplicaKeepDuration

Type:TimeSpan
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-TargetReplicaSetSize

Specifies the updated target replica set size for a Service Fabric stateful service. For more details, please see StatefulServiceDescription.TargetReplicaSetSizeDo not specify this parameter for a stateless service.

Type:Int32
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-TimeoutSec

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

Type:Int32
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

System.Uri

Outputs

System.Object