Restart-ServiceFabricReplica
Restarts a Service Fabric replica to simulate the reopening of a stateful service replica.
Syntax
ByNodeName
Restart-ServiceFabricReplica
[-NodeName] <String>
[-PartitionId] <Guid>
[-ReplicaOrInstanceId] <Int64>
[-CommandCompletionMode <CompletionMode>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
PartitionId
Restart-ServiceFabricReplica
[-PartitionId] <Guid>
-ServiceName <Uri>
[-CommandCompletionMode <CompletionMode>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
PartitionIdReplicaPrimary
Restart-ServiceFabricReplica
[-PartitionId] <Guid>
-ServiceName <Uri>
[-ReplicaKindPrimary]
[-CommandCompletionMode <CompletionMode>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
PartitionIdReplicaRandomSecondary
Restart-ServiceFabricReplica
[-PartitionId] <Guid>
-ServiceName <Uri>
[-ReplicaKindRandomSecondary]
[-CommandCompletionMode <CompletionMode>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
PartitionIdReplicaId
Restart-ServiceFabricReplica
[-PartitionId] <Guid>
[-ReplicaOrInstanceId] <Int64>
-ServiceName <Uri>
[-CommandCompletionMode <CompletionMode>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
ServiceName
Restart-ServiceFabricReplica
-ServiceName <Uri>
[-CommandCompletionMode <CompletionMode>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
ServiceNamePartitionSingleton
Restart-ServiceFabricReplica
-ServiceName <Uri>
[-PartitionKindSingleton]
[-CommandCompletionMode <CompletionMode>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
ServiceNamePartitionNamed
Restart-ServiceFabricReplica
-ServiceName <Uri>
-PartitionKey <String>
[-PartitionKindNamed]
[-CommandCompletionMode <CompletionMode>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
Restart-ServiceFabricReplica
-ServiceName <Uri>
-PartitionKey <String>
[-PartitionKindUniformInt64]
[-CommandCompletionMode <CompletionMode>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
ServiceNamePartitionSingletonReplicaRandomSecondary
Restart-ServiceFabricReplica
-ServiceName <Uri>
[-PartitionKindSingleton]
[-ReplicaKindRandomSecondary]
[-CommandCompletionMode <CompletionMode>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
ServiceNamePartitionNamedReplicaRandomSecondary
Restart-ServiceFabricReplica
-ServiceName <Uri>
-PartitionKey <String>
[-PartitionKindNamed]
[-ReplicaKindRandomSecondary]
[-CommandCompletionMode <CompletionMode>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
Restart-ServiceFabricReplica
-ServiceName <Uri>
-PartitionKey <String>
[-PartitionKindUniformInt64]
[-ReplicaKindRandomSecondary]
[-CommandCompletionMode <CompletionMode>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
ServiceNamePartitionSingletonReplicaPrimary
Restart-ServiceFabricReplica
-ServiceName <Uri>
[-PartitionKindSingleton]
[-ReplicaKindPrimary]
[-CommandCompletionMode <CompletionMode>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
ServiceNamePartitionNamedReplicaPrimary
Restart-ServiceFabricReplica
-ServiceName <Uri>
-PartitionKey <String>
[-PartitionKindNamed]
[-ReplicaKindPrimary]
[-CommandCompletionMode <CompletionMode>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
Restart-ServiceFabricReplica
-ServiceName <Uri>
-PartitionKey <String>
[-PartitionKindUniformInt64]
[-ReplicaKindPrimary]
[-CommandCompletionMode <CompletionMode>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
ServiceNamePartitionSingletonReplicaId
Restart-ServiceFabricReplica
[-ReplicaOrInstanceId] <Int64>
-ServiceName <Uri>
[-PartitionKindSingleton]
[-CommandCompletionMode <CompletionMode>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
ServiceNamePartitionNamedReplicaId
Restart-ServiceFabricReplica
[-ReplicaOrInstanceId] <Int64>
-ServiceName <Uri>
-PartitionKey <String>
[-PartitionKindNamed]
[-CommandCompletionMode <CompletionMode>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
Restart-ServiceFabricReplica
[-ReplicaOrInstanceId] <Int64>
-ServiceName <Uri>
-PartitionKey <String>
[-PartitionKindUniformInt64]
[-CommandCompletionMode <CompletionMode>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
ServiceNameReplicaPrimary
Restart-ServiceFabricReplica
-ServiceName <Uri>
[-ReplicaKindPrimary]
[-CommandCompletionMode <CompletionMode>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
ServiceNameReplicaRandomSecondary
Restart-ServiceFabricReplica
-ServiceName <Uri>
[-ReplicaKindRandomSecondary]
[-CommandCompletionMode <CompletionMode>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
ServiceNameReplicaId
Restart-ServiceFabricReplica
[-ReplicaOrInstanceId] <Int64>
-ServiceName <Uri>
[-CommandCompletionMode <CompletionMode>]
[-TimeoutSec <Int32>]
[<CommonParameters>]
Description
The Restart-ServiceFabricReplica cmdlet simulates a service replica failure by restarting a persisted service replica, closing the replica, and then reopening it.
Use this cmdlet to test your service for problems along the replica reopen path.
This cmdlet helps simulate the report fault temporary path through client APIs.
This cmdlet is only valid for replicas that belong to stateful persisted services.
In order to specify the replica to be restarted we can start either with the node name or the service name.
Then we need to specify the partition to which the replica belongs. We can specify the partition either by specifying the pair (naming scheme, partition key) or by specifying the partition ID. For more details on Microsoft Azure Service Fabric service partitioning, see Partition Service Fabric reliable services .
Lastly, we may need to specify which replica of the partition we are referring to and that can be done either by specifying the replica role (primary or secondary replica) or by specifying the replica ID.
In some cases, the user may want to restart a random partition/replica combination for a service instead of a specific one. This is useful for testability of your services when you want to run through a random set of transitions for your services to simulate real world failures. For example, if you provide only the service name to this cmdlet and leave out the partition and/or the replica information the cmdlet will make a choice at random to select a partition and a replica to fault. Please note the selected partition or replica will only belong to the specified service.
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: Restart a replica
PS C:\> Restart-ServiceFabricReplica -NodeName "Node07" -PartitionId 869dd2e9-fdda-42a5-ad96-4b71c795dfd3 -ReplicaOrInstanceId 12345098480948
This command restarts the replica on Node07 on the specified partition.
Example 2: Restart a primary replica
PS C:\> Restart-ServiceFabricReplica -ReplicaKindPrimary -PartitionKindNamed -PartitionKey "Partition1" -ServiceName fabric:/App/Service
This command restarts a primary replica on the specified partition.
Parameters
-CommandCompletionMode
Specifies whether the action waits for the Restart operation to complete.
Parameter properties
Type: CompletionMode
Default value: None
Accepted values: Invalid, DoNotVerify, Verify
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
-NodeName
Specifies the name of a Service Fabric node.
The cmdlet restarts a replica deployed on the node that you specify.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ByNodeName
Position: 0
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-PartitionId
Specifies the ID of the partition for which to restart the replica.
Parameter properties
Type: Guid
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ByNodeName
Position: 1
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
PartitionId
Position: 1
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
PartitionIdReplicaPrimary
Position: 1
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
PartitionIdReplicaRandomSecondary
Position: 1
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
PartitionIdReplicaId
Position: 1
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 for which the replica is restarted.
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
ServiceNamePartitionNamedReplicaRandomSecondary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionUniformedIntReplicaRandomSecondary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionNamedReplicaPrimary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionUniformedIntReplicaPrimary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionNamedReplicaId
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionUniformedIntReplicaId
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 restarts a replica on 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: True
Value from remaining arguments: False
ServiceNamePartitionNamedReplicaRandomSecondary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionNamedReplicaPrimary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionNamedReplicaId
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-PartitionKindSingleton
Indicates that this cmdlet restarts a replica on 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: True
Value from remaining arguments: False
ServiceNamePartitionSingletonReplicaRandomSecondary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionSingletonReplicaPrimary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionSingletonReplicaId
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
Indicates that this cmdlet restarts a replica on a UniformInt64 partition.
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
ServiceNamePartitionUniformedInt
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionUniformedIntReplicaRandomSecondary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionUniformedIntReplicaPrimary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionUniformedIntReplicaId
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-ReplicaKindPrimary
Indicates that this cmdlet restarts the replica for the primary replica.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
PartitionIdReplicaPrimary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionSingletonReplicaPrimary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionNamedReplicaPrimary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionUniformedIntReplicaPrimary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNameReplicaPrimary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-ReplicaKindRandomSecondary
Indicates that this cmdlet restarts a replica for a random secondary replica.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
PartitionIdReplicaRandomSecondary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionSingletonReplicaRandomSecondary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionNamedReplicaRandomSecondary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionUniformedIntReplicaRandomSecondary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNameReplicaRandomSecondary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-ReplicaOrInstanceId
Specifies a Service Fabric service replica or instance ID.
Parameter properties
Type: Int64
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ByNodeName
Position: 2
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
PartitionIdReplicaId
Position: 2
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionSingletonReplicaId
Position: 2
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionNamedReplicaId
Position: 2
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionUniformedIntReplicaId
Position: 2
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNameReplicaId
Position: 2
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-ServiceName
Specifies the name of a Service Fabric service.
Parameter properties
Type: Uri
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
PartitionIdReplicaPrimary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
PartitionIdReplicaRandomSecondary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
PartitionIdReplicaId
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceName
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionSingleton
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
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
ServiceNamePartitionSingletonReplicaRandomSecondary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionNamedReplicaRandomSecondary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionUniformedIntReplicaRandomSecondary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionSingletonReplicaPrimary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionNamedReplicaPrimary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionUniformedIntReplicaPrimary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionSingletonReplicaId
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionNamedReplicaId
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNamePartitionUniformedIntReplicaId
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNameReplicaPrimary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNameReplicaRandomSecondary
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
ServiceNameReplicaId
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 .
System.String
System.Guid
System.Uri
System.Management.Automation.SwitchParameter
System.Nullable`1
Outputs
System.Object