Restart-ServiceFabricPartition

Restart-ServiceFabricPartition

Restarts replicas of a Service Fabric partition to simulate a data center blackout or cluster blackout scenario.

Syntax

Parameter Set: PartitionId
Restart-ServiceFabricPartition -PartitionId <Guid> -RestartPartitionMode <RestartPartitionMode> {AllReplicasOrInstances | OnlyActiveSecondaries} -ServiceName <Uri> [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionNamed
Restart-ServiceFabricPartition -PartitionKey <String> -PartitionKindNamed -RestartPartitionMode <RestartPartitionMode> {AllReplicasOrInstances | OnlyActiveSecondaries} -ServiceName <Uri> [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionSingleton
Restart-ServiceFabricPartition -PartitionKindSingleton -RestartPartitionMode <RestartPartitionMode> {AllReplicasOrInstances | OnlyActiveSecondaries} -ServiceName <Uri> [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionUniformedInt
Restart-ServiceFabricPartition -PartitionKey <String> -PartitionKindUniformInt64 -RestartPartitionMode <RestartPartitionMode> {AllReplicasOrInstances | OnlyActiveSecondaries} -ServiceName <Uri> [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceNameRandomPartition
Restart-ServiceFabricPartition -RestartPartitionMode <RestartPartitionMode> {AllReplicasOrInstances | OnlyActiveSecondaries} -ServiceName <Uri> [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Detailed Description

The Restart-ServiceFabricPartition cmdlet simulates a data center blackout or cluster blackout scenario by restarting some or all of the replicas of a partition. For in-memory services, a restart would result in data loss. For persisted services that restart, no state data should be lost.

This operation is probabilistic. To ensure the data loss recovery path is tested, run this cmdlet multiple times.

If you exit the operation while it is running, a test state in the cluster may be left behind, which will put the cluster in a bad state. The chance of this error is remote, because the process would have to exit in the small time frame where that test state is set. If you experience any difficulties with services on that cluster run the Remove-ServiceFabricTestState cmdlet.

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

Parameters

-PartitionId<Guid>

Specifies the ID of the partition to restart.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-PartitionKey<String>

Specifies the key of the partition to restart.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-PartitionKindNamed

Indicates that this cmdlet restarts a named partition.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PartitionKindSingleton

Indicates that this cmdlet restarts a singleton partition.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PartitionKindUniformInt64

Indicates that this cmdlet restarts a UniformInt64 partition.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RestartPartitionMode<RestartPartitionMode>

Specifies whether to restart all replicas in the partition or only secondary partitions.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ServiceName<Uri>

Specifies the name of the service to restart.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-TimeoutSec<Int32]>

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

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see    about_CommonParameters.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • System.Uri

    Represents the name of a Service Fabric service.

  • System.Guid

    Represents the ID of a Service Fabric partition.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • System.Object

    This cmdlet returns a System.Fabric.Testability.RestartPartitionResult object that represents the operation result.

Examples

Example 1: Restart a partition

This command restarts the specified partition.

PS C:\> Restart-ServiceFabricPartition -ServiceName fabric:/TestSvc -PartitionKindSingleton -RestartPartitionMode OnlyActiveSecondaries

Example 2: Restart a partition for a specified partition key and partition kind

This command restarts the partition with partition key 23.

PS C:\> Restart-ServiceFabricPartition -ServiceName fabric:/TestSvc -PartitionKindUniformInt64 -PartitionKey "23" -RestartPartitionMode AllReplicasOrInstances

Get-ServiceFabricPartition

Remove-ServiceFabricTestState

Repair-ServiceFabricPartition