Restart-ServiceFabricDeployedCodePackage
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>]
[-ServicePackageActivationId <String>]
[-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>
-ServiceName <Uri>
[-ReplicaKindPrimary]
[-TimeoutSec <Int32>]
[<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
[-ApplicationName] <Uri>
[-CommandCompletionMode <CompletionMode>]
-PartitionId <Guid>
-ServiceName <Uri>
[-ReplicaKindRandomSecondary]
[-TimeoutSec <Int32>]
[<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
[-ApplicationName] <Uri>
[-CommandCompletionMode <CompletionMode>]
-PartitionId <Guid>
-ServiceName <Uri>
-ReplicaOrInstanceId <Int64>
[-TimeoutSec <Int32>]
[<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
[-ApplicationName] <Uri>
[-CommandCompletionMode <CompletionMode>]
-ServiceName <Uri>
[-TimeoutSec <Int32>]
[<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
[-ApplicationName] <Uri>
[-CommandCompletionMode <CompletionMode>]
-ServiceName <Uri>
[-PartitionKindSingleton]
[-TimeoutSec <Int32>]
[<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
[-ApplicationName] <Uri>
[-CommandCompletionMode <CompletionMode>]
-ServiceName <Uri>
[-PartitionKindNamed]
-PartitionKey <String>
[-TimeoutSec <Int32>]
[<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
[-ApplicationName] <Uri>
[-CommandCompletionMode <CompletionMode>]
-ServiceName <Uri>
[-PartitionKindUniformInt64]
-PartitionKey <String>
[-TimeoutSec <Int32>]
[<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
[-ApplicationName] <Uri>
[-CommandCompletionMode <CompletionMode>]
-ServiceName <Uri>
[-PartitionKindSingleton]
[-ReplicaKindRandomSecondary]
[-TimeoutSec <Int32>]
[<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
[-ApplicationName] <Uri>
[-CommandCompletionMode <CompletionMode>]
-ServiceName <Uri>
[-PartitionKindNamed]
-PartitionKey <String>
[-ReplicaKindRandomSecondary]
[-TimeoutSec <Int32>]
[<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
[-ApplicationName] <Uri>
[-CommandCompletionMode <CompletionMode>]
-ServiceName <Uri>
[-PartitionKindUniformInt64]
-PartitionKey <String>
[-ReplicaKindRandomSecondary]
[-TimeoutSec <Int32>]
[<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
[-ApplicationName] <Uri>
[-CommandCompletionMode <CompletionMode>]
-ServiceName <Uri>
[-PartitionKindSingleton]
[-ReplicaKindPrimary]
[-TimeoutSec <Int32>]
[<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
[-ApplicationName] <Uri>
[-CommandCompletionMode <CompletionMode>]
-ServiceName <Uri>
[-PartitionKindNamed]
-PartitionKey <String>
[-ReplicaKindPrimary]
[-TimeoutSec <Int32>]
[<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
[-ApplicationName] <Uri>
[-CommandCompletionMode <CompletionMode>]
-ServiceName <Uri>
[-PartitionKindUniformInt64]
-PartitionKey <String>
[-ReplicaKindPrimary]
[-TimeoutSec <Int32>]
[<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
[-ApplicationName] <Uri>
[-CommandCompletionMode <CompletionMode>]
-ServiceName <Uri>
[-PartitionKindSingleton]
-ReplicaOrInstanceId <Int64>
[-TimeoutSec <Int32>]
[<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
[-ApplicationName] <Uri>
[-CommandCompletionMode <CompletionMode>]
-ServiceName <Uri>
[-PartitionKindNamed]
-PartitionKey <String>
-ReplicaOrInstanceId <Int64>
[-TimeoutSec <Int32>]
[<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
[-ApplicationName] <Uri>
[-CommandCompletionMode <CompletionMode>]
-ServiceName <Uri>
[-PartitionKindUniformInt64]
-PartitionKey <String>
-ReplicaOrInstanceId <Int64>
[-TimeoutSec <Int32>]
[<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
[-ApplicationName] <Uri>
[-CommandCompletionMode <CompletionMode>]
-ServiceName <Uri>
[-ReplicaKindPrimary]
[-TimeoutSec <Int32>]
[<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
[-ApplicationName] <Uri>
[-CommandCompletionMode <CompletionMode>]
-ServiceName <Uri>
[-ReplicaKindRandomSecondary]
[-TimeoutSec <Int32>]
[<CommonParameters>]
Restart-ServiceFabricDeployedCodePackage
[-ApplicationName] <Uri>
[-CommandCompletionMode <CompletionMode>]
-ServiceName <Uri>
-ReplicaOrInstanceId <Int64>
[-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.
Parameters
-ApplicationName
Specifies the name of the application to which the code package belongs.
Type: | Uri |
Position: | 1 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-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: | 4 |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-CodePackageName
Specifies the name of the code package to restart.
Type: | String |
Position: | 3 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-CommandCompletionMode
Specifies whether the action waits for the restart to complete.
Type: | CompletionMode |
Accepted values: | Invalid, DoNotVerify, Verify |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-NodeName
Specifies the name of a Service Fabric node. The cmdlet restarts the node you specify.
Type: | String |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
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 |
Required: | True |
Accept pipeline input: | True |
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 |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-PartitionKindNamed
Indicates that this cmdlet restarts a code package on a named partition.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | True |
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 |
Required: | True |
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 |
Required: | True |
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 |
Required: | True |
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 |
Required: | True |
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 |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ServiceManifestName
Specifies the name of the service manifest where the code package is defined.
Type: | String |
Position: | 2 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ServiceName
Specifies the name of the service to which the code package belongs.
Type: | Uri |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-ServicePackageActivationId
The activation id of the deployed ServicePackage which contain the CodePackage. This can be obtained by using the query Get-ServiceFabricDeployedCodePackage.
If ServicePackageActivationMode specified at the time of creating the service (using New-ServiceFabricService
) is SharedProcess (or if it is not specified, in which case it defaults to SharedProcess), then value of ServicePackageActivationId is always an empty string and need not be specified. To learn more about service package activation id, please see [Service Fabric Hosting Model][1].
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TimeoutSec
Specifies the time-out period, in seconds, for the operation.
Type: | Int32 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
System.String
System.Uri
System.Nullable`1[[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
System.Guid
Outputs
System.Object