Move-ServiceFabricPrimaryReplica

Moves the Service Fabric primary replica of a stateful service partition.

Syntax

Move-ServiceFabricPrimaryReplica
    [-NodeName <String>]
    [-IgnoreConstraints <Boolean>]
    -PartitionId <Guid>
    -ServiceName <Uri>
    [-TimeoutSec <Int32>]
    [<CommonParameters>]
Move-ServiceFabricPrimaryReplica
    [-NodeName <String>]
    [-IgnoreConstraints <Boolean>]
    -ServiceName <Uri>
    [-TimeoutSec <Int32>]
    [<CommonParameters>]
Move-ServiceFabricPrimaryReplica
    [-NodeName <String>]
    [-IgnoreConstraints <Boolean>]
    -ServiceName <Uri>
    [-PartitionKindSingleton]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]
Move-ServiceFabricPrimaryReplica
    [-NodeName <String>]
    [-IgnoreConstraints <Boolean>]
    -ServiceName <Uri>
    [-PartitionKindNamed]
    -PartitionKey <String>
    [-TimeoutSec <Int32>]
    [<CommonParameters>]
Move-ServiceFabricPrimaryReplica
    [-NodeName <String>]
    [-IgnoreConstraints <Boolean>]
    -ServiceName <Uri>
    [-PartitionKindUniformInt64]
    -PartitionKey <String>
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

Description

The Move-ServiceFabricPrimaryReplica cmdlet moves the Service Fabric primary replica of a stateful service partition from the current primary node to a specified node. You can also perform this operation on system services. You cannot use this cmdlet for stateless services.

The Move-ServiceFabricPrimaryReplica cmdlet moves the primary replica to a new Service Fabric node location after the command is accepted. However, the load balancer may move the primary replica again based on load balancer constraints or on the load balancer balancing algorithm.

Starting with Service Fabric 7.1, Move-ServiceFabricPrimaryReplica takes aligned affinity into consideration. If the primary to be moved is a part of an aligned affinity relationship, then all replicas in that relationship will be moved together. If the primary replicas of such services are are not completely able to move within specified timeout, an exception will be thrown (FabricErrorCode.AsyncOperationNotComplete) indicating the services are temporarily in a torn aligned affinity state. To remediate, issue the operation again.

To use this cmdlet, you must be a member of the Administrators group.

Before using this cmdlet, connect to the Service Fabric cluster.

Examples

Example 1: Move the primary replica of a stateful service partition to a specified node

PS C:\> Move-ServiceFabricPrimaryReplica -PartitionId 93838f53-f1d9-4b99-8492-b802ee807d03 -NodeName "N0050" -ServiceName fabric:/SampleApp/SampleService

This command moves the primary replica of the specified stateful service partition to the node named N0050.

Example 2: Move the primary replica of a stateful service partition to a random node

PS C:\> Move-ServiceFabricPrimaryReplica -ServiceName fabric:/SampleApp/SampleService -PartitionId 93838f53-f1d9-4b99-8492-b802ee807d03

This command moves the primary replica of the specified stateful service partition to a random node because the NodeName parameter is not specified.

Example 3: Move the primary replica of a stateful service partition to a random node

PS C:\> Move-ServiceFabricPrimaryReplica -ServiceName fabric:/SampleApp1/PersistServ

This command moves the primary replica of the specified stateful service partition to a random node because the NodeName parameter is not specified. A random partition for the specified service is selected.

Parameters

-IgnoreConstraints

Indicates whether the cmdlet ignores constraints.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-NodeName

Specifies the name of a Service Fabric node. The cmdlet moves the primary replica to the node that you specify.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-PartitionId

Specifies the ID of the partition to move.

Type:Guid
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-PartitionKey

Specifies the key of the partition to move.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-PartitionKindNamed

Indicates that this cmdlet moves a named partition.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PartitionKindSingleton

Indicates that this cmdlet moves a singleton partition.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PartitionKindUniformInt64

Indicates that this cmdlet moves a UniformInt64 partitioned service.

Type:SwitchParameter
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ServiceName

Specifies the service name of the replica to move.

Type:Uri
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TimeoutSec

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

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

Inputs

System.String

System.Boolean

System.Guid

System.Uri

Outputs

System.Object