Restart-ServiceFabricDeployedCodePackage

Restart-ServiceFabricDeployedCodePackage

Restarts a code package deployed on a node in a cluster to simulate a process failure.

Syntax

Parameter Set: ByNodeName
Restart-ServiceFabricDeployedCodePackage [-NodeName] <String> [-ApplicationName] <Uri> [-ServiceManifestName] <String> [-CodePackageName] <String> [[-CodePackageInstanceId] <Int64]> ] [-CommandCompletionMode <CompletionMode]> ] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: PartitionId
Restart-ServiceFabricDeployedCodePackage -ApplicationName <Uri> -PartitionId <Guid> -ServiceName <Uri> [-CommandCompletionMode <CompletionMode]> ] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: PartitionIdReplicaId
Restart-ServiceFabricDeployedCodePackage -ApplicationName <Uri> -PartitionId <Guid> -ReplicaOrInstanceId <Int64]> -ServiceName <Uri> [-CommandCompletionMode <CompletionMode]> ] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: PartitionIdReplicaPrimary
Restart-ServiceFabricDeployedCodePackage -ApplicationName <Uri> -PartitionId <Guid> -ReplicaKindPrimary -ServiceName <Uri> [-CommandCompletionMode <CompletionMode]> ] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: PartitionIdReplicaRandomSecondary
Restart-ServiceFabricDeployedCodePackage -ApplicationName <Uri> -PartitionId <Guid> -ReplicaKindRandomSecondary -ServiceName <Uri> [-CommandCompletionMode <CompletionMode]> ] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceName
Restart-ServiceFabricDeployedCodePackage -ApplicationName <Uri> -ServiceName <Uri> [-CommandCompletionMode <CompletionMode]> ] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionNamed
Restart-ServiceFabricDeployedCodePackage -ApplicationName <Uri> -PartitionKey <String> -PartitionKindNamed -ServiceName <Uri> [-CommandCompletionMode <CompletionMode]> ] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionNamedReplicaId
Restart-ServiceFabricDeployedCodePackage -ApplicationName <Uri> -PartitionKey <String> -PartitionKindNamed -ReplicaOrInstanceId <Int64]> -ServiceName <Uri> [-CommandCompletionMode <CompletionMode]> ] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionNamedReplicaPrimary
Restart-ServiceFabricDeployedCodePackage -ApplicationName <Uri> -PartitionKey <String> -PartitionKindNamed -ReplicaKindPrimary -ServiceName <Uri> [-CommandCompletionMode <CompletionMode]> ] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionNamedReplicaRandomSecondary
Restart-ServiceFabricDeployedCodePackage -ApplicationName <Uri> -PartitionKey <String> -PartitionKindNamed -ReplicaKindRandomSecondary -ServiceName <Uri> [-CommandCompletionMode <CompletionMode]> ] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionSingleton
Restart-ServiceFabricDeployedCodePackage -ApplicationName <Uri> -PartitionKindSingleton -ServiceName <Uri> [-CommandCompletionMode <CompletionMode]> ] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionSingletonReplicaId
Restart-ServiceFabricDeployedCodePackage -ApplicationName <Uri> -PartitionKindSingleton -ReplicaOrInstanceId <Int64]> -ServiceName <Uri> [-CommandCompletionMode <CompletionMode]> ] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionSingletonReplicaPrimary
Restart-ServiceFabricDeployedCodePackage -ApplicationName <Uri> -PartitionKindSingleton -ReplicaKindPrimary -ServiceName <Uri> [-CommandCompletionMode <CompletionMode]> ] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionSingletonReplicaRandomSecondary
Restart-ServiceFabricDeployedCodePackage -ApplicationName <Uri> -PartitionKindSingleton -ReplicaKindRandomSecondary -ServiceName <Uri> [-CommandCompletionMode <CompletionMode]> ] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionUniformedInt
Restart-ServiceFabricDeployedCodePackage -ApplicationName <Uri> -PartitionKey <String> -PartitionKindUniformInt64 -ServiceName <Uri> [-CommandCompletionMode <CompletionMode]> ] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionUniformedIntReplicaId
Restart-ServiceFabricDeployedCodePackage -ApplicationName <Uri> -PartitionKey <String> -PartitionKindUniformInt64 -ReplicaOrInstanceId <Int64]> -ServiceName <Uri> [-CommandCompletionMode <CompletionMode]> ] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionUniformedIntReplicaPrimary
Restart-ServiceFabricDeployedCodePackage -ApplicationName <Uri> -PartitionKey <String> -PartitionKindUniformInt64 -ReplicaKindPrimary -ServiceName <Uri> [-CommandCompletionMode <CompletionMode]> ] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionUniformedIntReplicaRandomSecondary
Restart-ServiceFabricDeployedCodePackage -ApplicationName <Uri> -PartitionKey <String> -PartitionKindUniformInt64 -ReplicaKindRandomSecondary -ServiceName <Uri> [-CommandCompletionMode <CompletionMode]> ] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceNameReplicaId
Restart-ServiceFabricDeployedCodePackage -ApplicationName <Uri> -ReplicaOrInstanceId <Int64]> -ServiceName <Uri> [-CommandCompletionMode <CompletionMode]> ] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceNameReplicaPrimary
Restart-ServiceFabricDeployedCodePackage -ApplicationName <Uri> -ReplicaKindPrimary -ServiceName <Uri> [-CommandCompletionMode <CompletionMode]> ] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceNameReplicaRandomSecondary
Restart-ServiceFabricDeployedCodePackage -ApplicationName <Uri> -ReplicaKindRandomSecondary -ServiceName <Uri> [-CommandCompletionMode <CompletionMode]> ] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Detailed Description

The Restart-ServiceFabricDeployedCodePackage cmdlet ends the code package process, which restarts all of the user service replicas hosted in that process. This restart simulates code package process failures in the cluster, which tests the failover recovery paths of your service.

You can specify a code package, or you can specify a ReplicaSelector to restart the node and code package combination where the replica is hosted. This simplifies tests on the primary host node by not having to determine which Service Fabric node is the primary node before restarting that node.

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

Parameters

-ApplicationName<Uri>

Specifies the name of the application to which the code package belongs.

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-CodePackageInstanceId<Int64]>

Specifies the instance ID of the code package that is checked against the deployed one before restarting. If you specify 0, no comparison is done.

Aliases

none

Required?

false

Position?

5

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-CodePackageName<String>

Specifies the name of the code package to restart.

Aliases

none

Required?

true

Position?

4

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-CommandCompletionMode<CompletionMode]>

Specifies whether the action waits for the restart to complete.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-NodeName<String>

Specifies the name of a Service Fabric node. The cmdlet restarts the node you specify.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-PartitionId<Guid>

Specifies the ID of the partition for which the code package is restarted.

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 for which the code package is restarted.

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 code package on 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 code package on 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 code package on a UniformInt64 partition.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ReplicaKindPrimary

Indicates that this cmdlet restarts the code package for the primary replica.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ReplicaKindRandomSecondary

Indicates that this cmdlet restarts a code package for a random secondary replica.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ReplicaOrInstanceId<Int64]>

Specifies a Service Fabric service replica or instance ID.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-ServiceManifestName<String>

Specifies the name of the service manifest where the code package is defined.

Aliases

none

Required?

true

Position?

3

Default Value

none

Accept Pipeline Input?

true (ByPropertyName)

Accept Wildcard Characters?

false

-ServiceName<Uri>

Specifies the name of the service to which the code package belongs.

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

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

  • string

    Specifies the name of the Service Fabric service node.

Examples

Example 1: Restart a code package for a random secondary replica

This command restarts a code package for a random secondary replica on a singleton partition.

PS C:\> Restart-ServiceFabricDeployedCodePackage -ReplicaKindRandomSecondary -PartitionKindSingleton –ServiceName fabric:/SampleApp/SampleService –ApplicationName fabric:/SampleApp -CommandCompletionMode Verify

Example 2: Restart a specified code package

This command restarts the code package named CodePackage01 from the service manifest named ServiceManifest01 on the node named Node01.

PS C:\> Restart-ServiceFabricDeployedCodePackage -NodeName "Node01" -ApplicationName fabric:/App -CodePackageName "CodePackage01" -ServiceManifestName "ServiceManifest01" -CommandCompletionMode Verify

Get-ServiceFabricDeployedCodePackage