Remove-ServiceFabricReplica

Remove-ServiceFabricReplica

Removes a replica from a cluster to simulate a replica failure.

Syntax

Parameter Set: ByNodeName
Remove-ServiceFabricReplica [-NodeName] <String> [-PartitionId] <Guid> [-ReplicaOrInstanceId] <Int64]> [-CommandCompletionMode <Nullable [System.Fabric.Testability.CompletionMode]> ] [-ForceRemove] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: PartitionId
Remove-ServiceFabricReplica -PartitionId <Guid> -ServiceName <System.Uri> [-CommandCompletionMode <Nullable [System.Fabric.Testability.CompletionMode]> ] [-ForceRemove] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: PartitionIdReplicaId
Remove-ServiceFabricReplica -PartitionId <Guid> -ReplicaOrInstanceId <Int64]> -ServiceName <System.Uri> [-CommandCompletionMode <Nullable [System.Fabric.Testability.CompletionMode]> ] [-ForceRemove] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: PartitionIdReplicaPrimary
Remove-ServiceFabricReplica -PartitionId <Guid> -ReplicaKindPrimary -ServiceName <System.Uri> [-CommandCompletionMode <Nullable [System.Fabric.Testability.CompletionMode]> ] [-ForceRemove] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: PartitionIdReplicaRandomSecondary
Remove-ServiceFabricReplica -PartitionId <Guid> -ReplicaKindRandomSecondary -ServiceName <System.Uri> [-CommandCompletionMode <Nullable [System.Fabric.Testability.CompletionMode]> ] [-ForceRemove] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceName
Remove-ServiceFabricReplica -ServiceName <System.Uri> [-CommandCompletionMode <Nullable [System.Fabric.Testability.CompletionMode]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionNamed
Remove-ServiceFabricReplica -PartitionKey <System.String> -PartitionKindNamed -ServiceName <System.Uri> [-CommandCompletionMode <Nullable [System.Fabric.Testability.CompletionMode]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionNamedReplicaId
Remove-ServiceFabricReplica -PartitionKey <System.String> -PartitionKindNamed -ReplicaOrInstanceId <Int64]> -ServiceName <System.Uri> [-CommandCompletionMode <Nullable [System.Fabric.Testability.CompletionMode]> ] [-ForceRemove] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionNamedReplicaPrimary
Remove-ServiceFabricReplica -PartitionKey <System.String> -PartitionKindNamed -ReplicaKindPrimary -ServiceName <System.Uri> [-CommandCompletionMode <Nullable [System.Fabric.Testability.CompletionMode]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionNamedReplicaRandomSecondary
Remove-ServiceFabricReplica -PartitionKey <System.String> -PartitionKindNamed -ReplicaKindRandomSecondary -ServiceName <System.Uri> [-CommandCompletionMode <Nullable [System.Fabric.Testability.CompletionMode]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionSingleton
Remove-ServiceFabricReplica -PartitionKindSingleton -ServiceName <System.Uri> [-CommandCompletionMode <Nullable [System.Fabric.Testability.CompletionMode]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionSingletonReplicaId
Remove-ServiceFabricReplica -PartitionKindSingleton -ReplicaOrInstanceId <Int64]> -ServiceName <System.Uri> [-CommandCompletionMode <Nullable [System.Fabric.Testability.CompletionMode]> ] [-ForceRemove] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionSingletonReplicaPrimary
Remove-ServiceFabricReplica -PartitionKindSingleton -ReplicaKindPrimary -ServiceName <System.Uri> [-CommandCompletionMode <Nullable [System.Fabric.Testability.CompletionMode]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionSingletonReplicaRandomSecondary
Remove-ServiceFabricReplica -PartitionKindSingleton -ReplicaKindRandomSecondary -ServiceName <System.Uri> [-CommandCompletionMode <Nullable [System.Fabric.Testability.CompletionMode]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionUniformedInt
Remove-ServiceFabricReplica -PartitionKey <System.String> -PartitionKindUniformInt64 -ServiceName <System.Uri> [-CommandCompletionMode <Nullable [System.Fabric.Testability.CompletionMode]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionUniformedIntReplicaId
Remove-ServiceFabricReplica -PartitionKey <System.String> -PartitionKindUniformInt64 -ReplicaOrInstanceId <Int64]> -ServiceName <System.Uri> [-CommandCompletionMode <Nullable [System.Fabric.Testability.CompletionMode]> ] [-ForceRemove] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionUniformedIntReplicaPrimary
Remove-ServiceFabricReplica -PartitionKey <System.String> -PartitionKindUniformInt64 -ReplicaKindPrimary -ServiceName <System.Uri> [-CommandCompletionMode <Nullable [System.Fabric.Testability.CompletionMode]> ] [ <CommonParameters>]

Parameter Set: ServiceNamePartitionUniformedIntReplicaRandomSecondary
Remove-ServiceFabricReplica -PartitionKey <System.String> -PartitionKindUniformInt64 -ReplicaKindRandomSecondary -ServiceName <System.Uri> [-CommandCompletionMode <Nullable [System.Fabric.Testability.CompletionMode]> ] [ <CommonParameters>]

Parameter Set: ServiceNameReplicaId
Remove-ServiceFabricReplica -ReplicaOrInstanceId <Int64]> -ServiceName <System.Uri> [-CommandCompletionMode <Nullable [System.Fabric.Testability.CompletionMode]> ] [-ForceRemove] [-TimeoutSec <Int32]> ] [ <CommonParameters>]

Parameter Set: ServiceNameReplicaPrimary
Remove-ServiceFabricReplica -ReplicaKindPrimary -ServiceName <System.Uri> [-CommandCompletionMode <Nullable [System.Fabric.Testability.CompletionMode]> ] [ <CommonParameters>]

Parameter Set: ServiceNameReplicaRandomSecondary
Remove-ServiceFabricReplica -ReplicaKindRandomSecondary -ServiceName <System.Uri> [-CommandCompletionMode <Nullable [System.Fabric.Testability.CompletionMode]> ] [ <CommonParameters>]

Detailed Description

The Remove-ServiceFabricReplica cmdlet simulates a Service Fabric replica failure by removing a replica from a Service Fabric cluster. The removal closes the replica, transitions the replica to the role None, and then removes all of the state information of the replica from the cluster. This cmdlet tests the replica state removal path, and simulates the report fault permanent path through client APIs.

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

Parameters

-CommandCompletionMode<Nullable [System.Fabric.Testability.CompletionMode]>

Specifies whether the action waits for the remove operation to complete.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ForceRemove

Indicates that this cmdlet forces removal of the replica.

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 removes a replica deployed on the node that 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 from which to remove the replica.

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-PartitionKey<System.String>

Specifies the key of the partition for which the replica 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 removes a replica on a named partition.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-PartitionKindSingleton

Indicates that this cmdlet removes a replica on a singleton partition.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-PartitionKindUniformInt64

Indicates that this cmdlet removes a replica on a UniformInt64 partition.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-ReplicaKindPrimary

Indicates that this cmdlet removes the replica for the primary replica.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-ReplicaKindRandomSecondary

Indicates that this cmdlet removes a replica for a random secondary replica.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-ReplicaOrInstanceId<Int64]>

Specifies a Service Fabric service replica or instance ID.

Aliases

none

Required?

true

Position?

3

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-ServiceName<System.Uri>

Specifies the name of the service to remove.

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

    Represents the ID of a Service Fabric partition.

  • System.Uri

    Represents the name of a Service Fabric service.

  • string

    Specifies the name of a Service Fabric node.

Outputs

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

  • System.Object

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

Examples

Example 1: Remove a replica

This command removes a replica that belongs to the specified partition that is deployed on the specified node.

PS C:\> Remove-ServiceFabricReplica -NodeName "Node07" -PartitionId 869dd2e9-fdda-42a5-ad96-4b71c795dfd3 –ReplicaOrInstanceId 12345098480948

Example 2: Remove a primary replica

This command removes the primary replica that belongs to a specified named partition.

PS C:\> Remove-ServiceFabricReplica -ReplicaKindPrimary –PartitionKindNamed -PartitionKey "Partition1" –ServiceName fabric:/App/Service

Get-ServiceFabricReplica

Restart-ServiceFabricReplica