Share via


Restart-ServiceFabricNode

Restarts a Service Fabric node to simulate a cluster node failure.

Syntax

ByNodeName

Restart-ServiceFabricNode
    [-NodeName] <String>
    [[-NodeInstanceId] <BigInteger>]
    [-CommandCompletionMode <CompletionMode>]
    [-CreateFabricDump]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

PartitionId

Restart-ServiceFabricNode
    -PartitionId <Guid>
    -ServiceName <Uri>
    [-CommandCompletionMode <CompletionMode>]
    [-CreateFabricDump]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

PartitionIdReplicaPrimary

Restart-ServiceFabricNode
    -PartitionId <Guid>
    -ServiceName <Uri>
    [-CommandCompletionMode <CompletionMode>]
    [-CreateFabricDump]
    [-ReplicaKindPrimary]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

PartitionIdReplicaRandomSecondary

Restart-ServiceFabricNode
    -PartitionId <Guid>
    -ServiceName <Uri>
    [-CommandCompletionMode <CompletionMode>]
    [-CreateFabricDump]
    [-ReplicaKindRandomSecondary]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

PartitionIdReplicaId

Restart-ServiceFabricNode
    -PartitionId <Guid>
    -ServiceName <Uri>
    -ReplicaOrInstanceId <Int64>
    [-CommandCompletionMode <CompletionMode>]
    [-CreateFabricDump]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

ServiceName

Restart-ServiceFabricNode
    -ServiceName <Uri>
    [-CommandCompletionMode <CompletionMode>]
    [-CreateFabricDump]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

ServiceNamePartitionSingleton

Restart-ServiceFabricNode
    -ServiceName <Uri>
    [-CommandCompletionMode <CompletionMode>]
    [-CreateFabricDump]
    [-PartitionKindSingleton]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

ServiceNamePartitionNamed

Restart-ServiceFabricNode
    -ServiceName <Uri>
    -PartitionKey <String>
    [-CommandCompletionMode <CompletionMode>]
    [-CreateFabricDump]
    [-PartitionKindNamed]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

ServiceNamePartitionUniformedInt

Restart-ServiceFabricNode
    -ServiceName <Uri>
    -PartitionKey <String>
    [-CommandCompletionMode <CompletionMode>]
    [-CreateFabricDump]
    [-PartitionKindUniformInt64]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

ServiceNamePartitionSingletonReplicaRandomSecondary

Restart-ServiceFabricNode
    -ServiceName <Uri>
    [-CommandCompletionMode <CompletionMode>]
    [-CreateFabricDump]
    [-PartitionKindSingleton]
    [-ReplicaKindRandomSecondary]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

ServiceNamePartitionNamedReplicaRandomSecondary

Restart-ServiceFabricNode
    -ServiceName <Uri>
    -PartitionKey <String>
    [-CommandCompletionMode <CompletionMode>]
    [-CreateFabricDump]
    [-PartitionKindNamed]
    [-ReplicaKindRandomSecondary]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

ServiceNamePartitionUniformedIntReplicaRandomSecondary

Restart-ServiceFabricNode
    -ServiceName <Uri>
    -PartitionKey <String>
    [-CommandCompletionMode <CompletionMode>]
    [-CreateFabricDump]
    [-PartitionKindUniformInt64]
    [-ReplicaKindRandomSecondary]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

ServiceNamePartitionSingletonReplicaPrimary

Restart-ServiceFabricNode
    -ServiceName <Uri>
    [-CommandCompletionMode <CompletionMode>]
    [-CreateFabricDump]
    [-PartitionKindSingleton]
    [-ReplicaKindPrimary]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

ServiceNamePartitionNamedReplicaPrimary

Restart-ServiceFabricNode
    -ServiceName <Uri>
    -PartitionKey <String>
    [-CommandCompletionMode <CompletionMode>]
    [-CreateFabricDump]
    [-PartitionKindNamed]
    [-ReplicaKindPrimary]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

ServiceNamePartitionUniformedIntReplicaPrimary

Restart-ServiceFabricNode
    -ServiceName <Uri>
    -PartitionKey <String>
    [-CommandCompletionMode <CompletionMode>]
    [-CreateFabricDump]
    [-PartitionKindUniformInt64]
    [-ReplicaKindPrimary]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

ServiceNamePartitionSingletonReplicaId

Restart-ServiceFabricNode
    -ServiceName <Uri>
    -ReplicaOrInstanceId <Int64>
    [-CommandCompletionMode <CompletionMode>]
    [-CreateFabricDump]
    [-PartitionKindSingleton]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

ServiceNamePartitionNamedReplicaId

Restart-ServiceFabricNode
    -ServiceName <Uri>
    -PartitionKey <String>
    -ReplicaOrInstanceId <Int64>
    [-CommandCompletionMode <CompletionMode>]
    [-CreateFabricDump]
    [-PartitionKindNamed]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

ServiceNamePartitionUniformedIntReplicaId

Restart-ServiceFabricNode
    -ServiceName <Uri>
    -PartitionKey <String>
    -ReplicaOrInstanceId <Int64>
    [-CommandCompletionMode <CompletionMode>]
    [-CreateFabricDump]
    [-PartitionKindUniformInt64]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

ServiceNameReplicaPrimary

Restart-ServiceFabricNode
    -ServiceName <Uri>
    [-CommandCompletionMode <CompletionMode>]
    [-CreateFabricDump]
    [-ReplicaKindPrimary]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

ServiceNameReplicaRandomSecondary

Restart-ServiceFabricNode
    -ServiceName <Uri>
    [-CommandCompletionMode <CompletionMode>]
    [-CreateFabricDump]
    [-ReplicaKindRandomSecondary]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

ServiceNameReplicaId

Restart-ServiceFabricNode
    -ServiceName <Uri>
    -ReplicaOrInstanceId <Int64>
    [-CommandCompletionMode <CompletionMode>]
    [-CreateFabricDump]
    [-TimeoutSec <Int32>]
    [<CommonParameters>]

Description

The Restart-ServiceFabricNode cmdlet restarts a Service Fabric node by restarting the Fabric.exe process that hosts the node. This cmdlet simulates Service Fabric node failures in the cluster, which tests the failover recovery paths of your service. For more information, see Using test actions.

The Service Fabric node to be restarted can specified in the following ways:

  • Specify node name and optionally the node instance ID.
  • Specify a stateful service replica or stateless service instance and let the cmdlet identify and restart the node that hosts it. The folowing implicit behaviors for replica/instance selection are worth noting:
    • If the service does not use a Singleton partition and neither the PartitionId nor PartitionKey parameter is specified, then the cmdlet picks a partition randomly.
    • If the service is a stateful service and none of the Primary, RandomSecondary and ReplicaOrInstanceId parameters are specified, then the cmdlet randomly picks a replica, regardless of its role.
    • If the service is a stateless service and the ReplicaOrInstanceId parameter is not specified, then the cmdlet randomly picks an instance.

If you specify a non-zero value for the NodeInstanceId parameter, that ID is compared with the active node ID. If the IDs do not match, the process is not restarted and an error occurs. A stale message can cause this error.

If you specify the CreateFabricDump parameter, this cmdlet causes the Fabric.exe process to crash on the specified node during restart. This crash creates a process dump for Fabric.exe.

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 node that hosts a primary replica

PS C:\> Restart-ServiceFabricNode -ReplicaKindPrimary -PartitionKindNamed -PartitionKey "Partition3" -CommandCompletionMode Verify

This command restarts the node that hosts the primary replica of the partition named Partition3. Because the CommandCompletionMode parameter is specified with a value of Verify, the command waits for the target node to restart before it completes.

Example 2: Restart a specified node

PS C:\> Restart-ServiceFabricNode -NodeName "Node01" -CommandCompletionMode DoNotVerify

This command restarts the node named Node01. Because the CommandCompletionMode parameter is specified with a value of DoNotVerify, the command does not wait for the node to restart before it completes.

Parameters

-CommandCompletionMode

Specifies whether the action waits for the restart to complete. Specify Verify to make the cmdlet wait for restart to complete, and DoNotVerify to make the cmdlet return without waiting for restart 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

-CreateFabricDump

Indicates that a process dump should be created for Fabric.exe on specified node.

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

-NodeInstanceId

Specifies a node instance ID. Unless you specify 0, the node instance ID that you specify must match the currently running node. To obtain node instance IDs, run Get-ServiceFabricNode for the target node. For example, for the node N0050, the command Get-ServiceFabricNode -NodeName "N0050" returns a Node object that contains the node instance ID.

Parameter properties

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

Parameter sets

ByNodeName
Position:1
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 restarts 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 partition ID of a Service Fabric service partition. The cmdlet restarts a node that hosts a replica or instance of this partition.

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
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

-PartitionKey

Specifies a partition key for a Service Fabric service partition. The cmdlet identifies the partition that this partition key maps to and restarts a node that hosts a replica or instance of that partition..

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 the PartitionKey parameter specifies a partition key for a service that uses Named partitioning scheme.

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
ServiceNamePartitionNamedReplicaRandomSecondary
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ServiceNamePartitionNamedReplicaPrimary
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ServiceNamePartitionNamedReplicaId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PartitionKindSingleton

Indicates that the service specified in the ServiceName parameter uses 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
ServiceNamePartitionSingletonReplicaRandomSecondary
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ServiceNamePartitionSingletonReplicaPrimary
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ServiceNamePartitionSingletonReplicaId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PartitionKindUniformInt64

Indicates that the PartitionKey parameter specifies a partition key for a service that uses UniformInt64 partitioning scheme.

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
ServiceNamePartitionUniformedIntReplicaRandomSecondary
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ServiceNamePartitionUniformedIntReplicaPrimary
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ServiceNamePartitionUniformedIntReplicaId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ReplicaKindPrimary

Indicates that this cmdlet restarts the node that hosts the primary replica of the specified partition.

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:False
Value from remaining arguments:False
ServiceNamePartitionSingletonReplicaPrimary
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ServiceNamePartitionNamedReplicaPrimary
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ServiceNamePartitionUniformedIntReplicaPrimary
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ServiceNameReplicaPrimary
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ReplicaKindRandomSecondary

Indicates that this cmdlet restarts the node that hosts a random secondary replica of the specified partition.

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:False
Value from remaining arguments:False
ServiceNamePartitionSingletonReplicaRandomSecondary
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ServiceNamePartitionNamedReplicaRandomSecondary
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ServiceNamePartitionUniformedIntReplicaRandomSecondary
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ServiceNameReplicaRandomSecondary
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ReplicaOrInstanceId

Specifies a Service Fabric service replica or instance ID. The cmdlet restarts the node that hosts the specified replica or instance.

Parameter properties

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

Parameter sets

PartitionIdReplicaId
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
ServiceNameReplicaId
Position:Named
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. The cmdlet restarts a node that hosts a replica or instance of this 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.

Inputs

System.String

System.Nullable`1

System.Guid

System.Uri

System.Nullable`1

Outputs

System.Object