New-​Service​Fabric​Service​Group

Creates a Service Fabric service group.

Syntax

New-ServiceFabricServiceGroup
   [-Stateful]
   [-PartitionSchemeUniformInt64]
   [-Adhoc]
   [-ServiceName] <Uri>
   [-ServiceTypeName] <String>
   [-Correlation <String[]>]
   [-HasPersistedState]
   -HighKey <Int64>
   -LowKey <Int64>
   [-Metric <String[]>]
   -MinReplicaSetSize <Int32>
   -PartitionCount <Int32>
   [-PlacementConstraint <String>]
   [-PlacementPolicy <String[]>]
   [-QuorumLossWaitDuration <TimeSpan>]
   [-ReplicaRestartWaitDuration <TimeSpan>]
   -ServiceGroupMemberDescription <Hashtable[]>
   -TargetReplicaSetSize <Int32>
   [-TimeoutSec <Int32>]
   [<CommonParameters>]
New-ServiceFabricServiceGroup
   [-Stateful]
   [-PartitionSchemeSingleton]
   [-Adhoc]
   [-ServiceName] <Uri>
   [-ServiceTypeName] <String>
   [-Correlation <String[]>]
   [-HasPersistedState]
   [-Metric <String[]>]
   -MinReplicaSetSize <Int32>
   [-PlacementConstraint <String>]
   [-PlacementPolicy <String[]>]
   [-QuorumLossWaitDuration <TimeSpan>]
   [-ReplicaRestartWaitDuration <TimeSpan>]
   -ServiceGroupMemberDescription <Hashtable[]>
   -TargetReplicaSetSize <Int32>
   [-TimeoutSec <Int32>]
   [<CommonParameters>]
New-ServiceFabricServiceGroup
   [-Stateful]
   [-PartitionSchemeNamed]
   [-Adhoc]
   [-ServiceName] <Uri>
   [-ServiceTypeName] <String>
   [-Correlation <String[]>]
   [-HasPersistedState]
   [-Metric <String[]>]
   -MinReplicaSetSize <Int32>
   -PartitionNames <String[]>
   [-PlacementConstraint <String>]
   [-PlacementPolicy <String[]>]
   [-QuorumLossWaitDuration <TimeSpan>]
   [-ReplicaRestartWaitDuration <TimeSpan>]
   -ServiceGroupMemberDescription <Hashtable[]>
   -TargetReplicaSetSize <Int32>
   [-TimeoutSec <Int32>]
   [<CommonParameters>]
New-ServiceFabricServiceGroup
   [-Stateless]
   [-PartitionSchemeUniformInt64]
   [-Adhoc]
   [-ServiceName] <Uri>
   [-ServiceTypeName] <String>
   [-Correlation <String[]>]
   -HighKey <Int64>
   -InstanceCount <Int32>
   -LowKey <Int64>
   [-Metric <String[]>]
   -PartitionCount <Int32>
   [-PlacementConstraint <String>]
   [-PlacementPolicy <String[]>]
   -ServiceGroupMemberDescription <Hashtable[]>
   [-TimeoutSec <Int32>]
   [<CommonParameters>]
New-ServiceFabricServiceGroup
   [-Stateless]
   [-PartitionSchemeSingleton]
   [-Adhoc]
   [-ServiceName] <Uri>
   [-ServiceTypeName] <String>
   [-Correlation <String[]>]
   -InstanceCount <Int32>
   [-Metric <String[]>]
   [-PlacementConstraint <String>]
   [-PlacementPolicy <String[]>]
   -ServiceGroupMemberDescription <Hashtable[]>
   [-TimeoutSec <Int32>]
   [<CommonParameters>]
New-ServiceFabricServiceGroup
   [-Stateless]
   [-PartitionSchemeNamed]
   [-Adhoc]
   [-ServiceName] <Uri>
   [-ServiceTypeName] <String>
   [-Correlation <String[]>]
   -InstanceCount <Int32>
   [-Metric <String[]>]
   -PartitionNames <String[]>
   [-PlacementConstraint <String>]
   [-PlacementPolicy <String[]>]
   -ServiceGroupMemberDescription <Hashtable[]>
   [-TimeoutSec <Int32>]
   [<CommonParameters>]
New-ServiceFabricServiceGroup
   [-Stateless]
   [-PartitionSchemeSingleton]
   [-ApplicationName] <Uri>
   [-ServiceName] <Uri>
   [-ServiceTypeName] <String>
   [-Correlation <String[]>]
   -InstanceCount <Int32>
   [-Metric <String[]>]
   [-PlacementConstraint <String>]
   [-PlacementPolicy <String[]>]
   -ServiceGroupMemberDescription <Hashtable[]>
   [-TimeoutSec <Int32>]
   [<CommonParameters>]
New-ServiceFabricServiceGroup
   [-Stateful]
   [-PartitionSchemeUniformInt64]
   [-ApplicationName] <Uri>
   [-ServiceName] <Uri>
   [-ServiceTypeName] <String>
   [-Correlation <String[]>]
   [-HasPersistedState]
   -HighKey <Int64>
   -LowKey <Int64>
   [-Metric <String[]>]
   -MinReplicaSetSize <Int32>
   -PartitionCount <Int32>
   [-PlacementConstraint <String>]
   [-PlacementPolicy <String[]>]
   [-QuorumLossWaitDuration <TimeSpan>]
   [-ReplicaRestartWaitDuration <TimeSpan>]
   -ServiceGroupMemberDescription <Hashtable[]>
   -TargetReplicaSetSize <Int32>
   [-TimeoutSec <Int32>]
   [<CommonParameters>]
New-ServiceFabricServiceGroup
   [-Stateful]
   [-PartitionSchemeNamed]
   [-ApplicationName] <Uri>
   [-ServiceName] <Uri>
   [-ServiceTypeName] <String>
   [-Correlation <String[]>]
   [-HasPersistedState]
   [-Metric <String[]>]
   -MinReplicaSetSize <Int32>
   -PartitionNames <String[]>
   [-PlacementConstraint <String>]
   [-PlacementPolicy <String[]>]
   [-QuorumLossWaitDuration <TimeSpan>]
   [-ReplicaRestartWaitDuration <TimeSpan>]
   -ServiceGroupMemberDescription <Hashtable[]>
   -TargetReplicaSetSize <Int32>
   [-TimeoutSec <Int32>]
   [<CommonParameters>]
New-ServiceFabricServiceGroup
   [-Stateful]
   [-PartitionSchemeSingleton]
   [-ApplicationName] <Uri>
   [-ServiceName] <Uri>
   [-ServiceTypeName] <String>
   [-Correlation <String[]>]
   [-HasPersistedState]
   [-Metric <String[]>]
   -MinReplicaSetSize <Int32>
   [-PlacementConstraint <String>]
   [-PlacementPolicy <String[]>]
   [-QuorumLossWaitDuration <TimeSpan>]
   [-ReplicaRestartWaitDuration <TimeSpan>]
   -ServiceGroupMemberDescription <Hashtable[]>
   -TargetReplicaSetSize <Int32>
   [-TimeoutSec <Int32>]
   [<CommonParameters>]
New-ServiceFabricServiceGroup
   [-Stateless]
   [-PartitionSchemeNamed]
   [-ApplicationName] <Uri>
   [-ServiceName] <Uri>
   [-ServiceTypeName] <String>
   [-Correlation <String[]>]
   -InstanceCount <Int32>
   [-Metric <String[]>]
   -PartitionNames <String[]>
   [-PlacementConstraint <String>]
   [-PlacementPolicy <String[]>]
   -ServiceGroupMemberDescription <Hashtable[]>
   [-TimeoutSec <Int32>]
   [<CommonParameters>]
New-ServiceFabricServiceGroup
   [-Stateless]
   [-PartitionSchemeUniformInt64]
   [-ApplicationName] <Uri>
   [-ServiceName] <Uri>
   [-ServiceTypeName] <String>
   [-Correlation <String[]>]
   -HighKey <Int64>
   -InstanceCount <Int32>
   -LowKey <Int64>
   [-Metric <String[]>]
   -PartitionCount <Int32>
   [-PlacementConstraint <String>]
   [-PlacementPolicy <String[]>]
   -ServiceGroupMemberDescription <Hashtable[]>
   [-TimeoutSec <Int32>]
   [<CommonParameters>]

Description

The New-ServiceFabricServiceGroup cmdlet creates a Service Fabric service group. This cmdlet is similar to the New-ServiceFabricService cmdlet, except that this cmdlet creates a service group, and New-ServiceFabricService creates a service.

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: Create a stateful service group

PS C:\> New-ServiceFabricServiceGroup -ApplicationName fabric:/myapp/persistenttodolist -ServiceName fabric:/myapp/persistenttodolist/svc1 -ServiceTypeName "PersistentToDoListServiceGroupType" -Stateful -PartitionSchemeSingleton -TargetReplicaSetSize 3 -MinReplicaSetSize 2 -ServiceGroupMemberDescription @(@{"ServiceName"="fabric:/myapp/persistenttodolist/svc1#a";"ServiceTypeName"=" PersistentToDoListServiceGroupTypeA"},@{"ServiceName"="fabric:/myapp/persistenttodolist/svc1#b";"ServiceTypeName"=" PersistentToDoListServiceGroupTypeB"})

This command creates a Service Fabric stateful service group from the specified application instance by using a singleton partition scheme.

Required Parameters

-Adhoc

Indicates that the service runs in ad hoc mode. In ad hoc mode, you manually activate the service host.

Type:SwitchParameter
Position:3
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ApplicationName

Specifies the Uniform Resource Identifier (URI) of a Service Fabric application. The cmdlet creates a service group based on the application that has the URI that you specify.

Type:Uri
Position:3
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-HighKey

Specifies the high-key range of the partition set.

Type:Int64
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InstanceCount

Specifies the number of instances for the stateless service.

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

Specifies the low-key range of the partition set.

Type:Int64
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-MinReplicaSetSize

Specifies the minimum replica set size for the Service Fabric stateful service.

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

Specifies the number of partition counts for the service.

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

Specifies an array of names of partitions.

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PartitionSchemeNamed

Indicates that the service uses the named partition scheme.

Type:SwitchParameter
Position:2
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PartitionSchemeSingleton

Indicates that the service uses the singleton partition scheme.

Type:SwitchParameter
Position:2
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PartitionSchemeUniformInt64

Indicates that the service uses the UniformInt64 partition scheme.

Type:SwitchParameter
Position:2
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ServiceGroupMemberDescription

Indicates the member configurations of a service group. Specify the value for this parameter in the following format:@(@{"ServiceName"=<serviceName>;"ServiceTypeName"=<serviceType>;"LoadMetrics"=<metrics>}).

For example: @(@{"ServiceName"="fabric:/myapp/calculator/svc1;"ServiceTypeName"="CalculatorServiceType"})

Type:Hashtable[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ServiceName

Specifies the URI of a Service Fabric service group.

Type:Uri
Position:4
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ServiceTypeName

Specifies the name of a Service Fabric service type.

Type:String
Position:5
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Stateful

Indicates that the service is a Service Fabric stateful service.

Type:SwitchParameter
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Stateless

Indicates that the service is a Service Fabric stateless service.

Type:SwitchParameter
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-TargetReplicaSetSize

Specifies the target replica set size for a Service Fabric stateful service.

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

Optional Parameters

-Correlation

Specifies an array of correlation constraints for this service.

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-HasPersistedState

Indicates that the stateful service has persistent state.

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

Specifies an array of metrics that the service reports.

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PlacementConstraint

Specifies the placement constraint for the service.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PlacementPolicy

Specifies an array of placement policies for a service.

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-QuorumLossWaitDuration

Specifies the duration, as a TimeSpan object, that Service Fabric waits before it declares data loss for the service partition. To obtain a TimeSpan object, use the New-TimeSpan cmdlet. For more information, type Get-Help New-TimeSpan.

Type:TimeSpan
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ReplicaRestartWaitDuration

Specifies the interval, as a TimeSpan object, that Service Fabric waits for the replica to restart before it fails over the replica. To obtain a TimeSpan object, use the New-TimeSpan cmdlet.

Type:TimeSpan
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

None.

You cannot pipe input to this cmdlet.

Outputs

System.Object

This cmdlet returns a System.Fabric.Description.ServiceGroupDescription object for a Service Fabric service.