Get-​Service​Fabric​Replica

Gets the list of System.Fabric.Query.Replica (https://docs.microsoft.com/dotnet/api/system.fabric.query.replica)objects. System.Fabric.Query.Replica (https://docs.microsoft.com/dotnet/api/system.fabric.query.replica)contains information on the Service Fabric replica including health state and the address replica is listening on. This cmdlet is commonly used for diagnostic purposes.

Syntax

Get-ServiceFabricReplica
   [-PartitionId] <Guid>
   [[-ReplicaOrInstanceId] <Int64>]
   [-ReplicaStatusFilter <ServiceReplicaStatusFilter>]
   [-TimeoutSec <Int32>]
   [<CommonParameters>]

Description

The Get-ServiceFabricReplica cmdlet gets Service Fabric replicas of a partition.

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: Get the replica for a partition

PS C:\> $CalculatorPartition01 = Get-ServiceFabricPartition -ServiceName fabric:/myapp/calculator/svc1
PS C:\> Get-ServiceFabricReplica -PartitionId $CalculatorPartition01.PartitionId

The first command uses the Get-ServiceFabricPartition cmdlet to get the partition for the specified service, and then stores it in the $CalculatorPartition01.

The second command gets the Service Fabric replica by using the PartitionId property of the partition stored in $CalculatorPartition01.

Example 2: Get the partitioned replicas for a system service

PS C:\> Get-ServiceFabricPartition -ServiceName fabric:/System/FailoverManagerService | Get-ServiceFabricReplica

This command gets the list of replicas for the Failover Manager system service.

Required Parameters

-PartitionId

Specifies the ID of a Service Fabric partition.

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

Optional Parameters

-ReplicaOrInstanceId

Specifies a Service Fabric service replica or instance ID.

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

Specifies the replica status filter as a ServiceReplicaStatusFilter object.

Type:ServiceReplicaStatusFilter
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.Guid, Int64

Outputs

System.Object