Restart-​Service​Fabric​Deployed​Code​Package

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

Syntax

Restart-ServiceFabricDeployedCodePackage
       [-NodeName] <String>
       [-ApplicationName] <Uri>
       [-ServiceManifestName] <String>
       [-CodePackageName] <String>
       [[-CodePackageInstanceId] <Int64>]
       [-CommandCompletionMode <CompletionMode>]
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
       [-ApplicationName] <Uri>
       [-CommandCompletionMode <CompletionMode>]
       -PartitionId <Guid>
       -ServiceName <Uri>
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
       [-ApplicationName] <Uri>
       [-CommandCompletionMode <CompletionMode>]
       -PartitionId <Guid>
       [-ReplicaKindRandomSecondary]
       -ServiceName <Uri>
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
       [-ApplicationName] <Uri>
       [-CommandCompletionMode <CompletionMode>]
       -PartitionId <Guid>
       -ReplicaOrInstanceId <Int64>
       -ServiceName <Uri>
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
       [-ApplicationName] <Uri>
       [-CommandCompletionMode <CompletionMode>]
       -PartitionId <Guid>
       [-ReplicaKindPrimary]
       -ServiceName <Uri>
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
       [-ApplicationName] <Uri>
       [-CommandCompletionMode <CompletionMode>]
       -PartitionKey <String>
       [-PartitionKindNamed]
       [-ReplicaKindRandomSecondary]
       -ServiceName <Uri>
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
       [-ApplicationName] <Uri>
       [-CommandCompletionMode <CompletionMode>]
       -PartitionKey <String>
       [-PartitionKindNamed]
       -ServiceName <Uri>
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
       [-ApplicationName] <Uri>
       [-CommandCompletionMode <CompletionMode>]
       -PartitionKey <String>
       [-PartitionKindUniformInt64]
       -ServiceName <Uri>
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
       [-ApplicationName] <Uri>
       [-CommandCompletionMode <CompletionMode>]
       -PartitionKey <String>
       [-PartitionKindNamed]
       [-ReplicaKindPrimary]
       -ServiceName <Uri>
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
       [-ApplicationName] <Uri>
       [-CommandCompletionMode <CompletionMode>]
       -PartitionKey <String>
       [-PartitionKindUniformInt64]
       -ReplicaOrInstanceId <Int64>
       -ServiceName <Uri>
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
       [-ApplicationName] <Uri>
       [-CommandCompletionMode <CompletionMode>]
       -PartitionKey <String>
       [-PartitionKindUniformInt64]
       [-ReplicaKindRandomSecondary]
       -ServiceName <Uri>
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
       [-ApplicationName] <Uri>
       [-CommandCompletionMode <CompletionMode>]
       -PartitionKey <String>
       [-PartitionKindUniformInt64]
       [-ReplicaKindPrimary]
       -ServiceName <Uri>
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
       [-ApplicationName] <Uri>
       [-CommandCompletionMode <CompletionMode>]
       -PartitionKey <String>
       [-PartitionKindNamed]
       -ReplicaOrInstanceId <Int64>
       -ServiceName <Uri>
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
       [-ApplicationName] <Uri>
       [-CommandCompletionMode <CompletionMode>]
       [-PartitionKindSingleton]
       -ServiceName <Uri>
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
       [-ApplicationName] <Uri>
       [-CommandCompletionMode <CompletionMode>]
       [-PartitionKindSingleton]
       [-ReplicaKindRandomSecondary]
       -ServiceName <Uri>
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
       [-ApplicationName] <Uri>
       [-CommandCompletionMode <CompletionMode>]
       [-PartitionKindSingleton]
       [-ReplicaKindPrimary]
       -ServiceName <Uri>
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
       [-ApplicationName] <Uri>
       [-CommandCompletionMode <CompletionMode>]
       [-PartitionKindSingleton]
       -ReplicaOrInstanceId <Int64>
       -ServiceName <Uri>
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
       [-ApplicationName] <Uri>
       [-CommandCompletionMode <CompletionMode>]
       [-ReplicaKindPrimary]
       -ServiceName <Uri>
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
       [-ApplicationName] <Uri>
       [-CommandCompletionMode <CompletionMode>]
       [-ReplicaKindRandomSecondary]
       -ServiceName <Uri>
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
       [-ApplicationName] <Uri>
       [-CommandCompletionMode <CompletionMode>]
       -ReplicaOrInstanceId <Int64>
       -ServiceName <Uri>
       [-TimeoutSec <Int32>]
       [<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
       [-ApplicationName] <Uri>
       [-CommandCompletionMode <CompletionMode>]
       -ServiceName <Uri>
       [-TimeoutSec <Int32>]
       [<CommonParameters>]

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 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 code package for a random secondary replica

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

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

Example 2: Restart a specified code package

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

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

Required Parameters

-ApplicationName

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

Type:Uri
Position:2
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-CodePackageName

Specifies the name of the code package to restart.

Type:String
Position:4
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-NodeName

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

Type:String
Position:1
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-PartitionId

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

Type:Guid
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-PartitionKey

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

Type:String
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.

Type:SwitchParameter
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.

Type:SwitchParameter
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.

Type:SwitchParameter
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.

Type:SwitchParameter
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.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ReplicaOrInstanceId

Specifies a Service Fabric service replica or instance ID.

Type:Int64
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ServiceManifestName

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

Type:String
Position:3
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ServiceName

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

Type:Uri
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-CodePackageInstanceId

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.

Type:Int64
Position:5
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-CommandCompletionMode

Specifies whether the action waits for the restart to complete.

Type:CompletionMode
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-TimeoutSec

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

Type:Int32
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

System.Uri

Represents the name of a Service Fabric application.

Inputs

System.Uri

Represents the name of a Service Fabric service.

Inputs

System.Guid

Represents the ID of a Service Fabric partition.

Outputs

string

Specifies the name of the Service Fabric service node.