Move-ServiceFabricPrimaryReplica
Moves the Service Fabric primary replica of a stateful service partition.
Syntax
PartitionId
Move-ServiceFabricPrimaryReplica
-PartitionId <Guid>
-ServiceName <Uri>
[-NodeName <String>]
[-IgnoreConstraints <Boolean>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
ServiceNameRandomPartition
Move-ServiceFabricPrimaryReplica
-ServiceName <Uri>
[-NodeName <String>]
[-IgnoreConstraints <Boolean>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
ServiceNamePartitionSingleton
Move-ServiceFabricPrimaryReplica
-ServiceName <Uri>
[-NodeName <String>]
[-IgnoreConstraints <Boolean>]
[-PartitionKindSingleton]
[-TimeoutSec <Int32>]
[<CommonParameters>]
ServiceNamePartitionNamed
Move-ServiceFabricPrimaryReplica
-ServiceName <Uri>
-PartitionKey <String>
[-NodeName <String>]
[-IgnoreConstraints <Boolean>]
[-PartitionKindNamed]
[-TimeoutSec <Int32>]
[<CommonParameters>]
ServiceNamePartitionUniformedInt
Move-ServiceFabricPrimaryReplica
-ServiceName <Uri>
-PartitionKey <String>
[-NodeName <String>]
[-IgnoreConstraints <Boolean>]
[-PartitionKindUniformInt64]
[-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.
Parameter properties
Type: | Boolean |
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: | True |
Value from remaining arguments: | False |
-NodeName
Specifies the name of a Service Fabric node. The cmdlet moves the primary replica to the node that you specify.
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: | True |
Value from remaining arguments: | False |
-PartitionId
Specifies the ID of the partition to move.
Parameter properties
Type: | Guid |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
PartitionId
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-PartitionKey
Specifies the key of the partition to move.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
ServiceNamePartitionNamed
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
ServiceNamePartitionUniformedInt
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-PartitionKindNamed
Indicates that this cmdlet moves a named partition.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
ServiceNamePartitionNamed
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-PartitionKindSingleton
Indicates that this cmdlet moves a singleton partition.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
ServiceNamePartitionSingleton
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-PartitionKindUniformInt64
Indicates that this cmdlet moves a UniformInt64 partitioned service.
Parameter properties
Type: | SwitchParameter |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
ServiceNamePartitionUniformedInt
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-ServiceName
Specifies the service name of the replica to move.
Parameter properties
Type: | Uri |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | True |
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 |
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.