New-ServiceFabricServiceGroup

Creates a Service Fabric service group.

Syntax

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

Parameters

-Adhoc

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

Type:SwitchParameter
Position:2
Default value:None
Required:True
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:2
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Correlation

Specifies an array of correlation constraints for this service.

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

-HasPersistedState

Indicates that the stateful service has persistent state.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
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
Required:True
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
Required:True
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
Required:True
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
Required:False
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
Required:True
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
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PartitionNames

Specifies an array of names of partitions.

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

-PartitionSchemeNamed

Indicates that the service uses the named partition scheme.

Type:SwitchParameter
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PartitionSchemeSingleton

Indicates that the service uses the singleton partition scheme.

Type:SwitchParameter
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PartitionSchemeUniformInt64

Indicates that the service uses the UniformInt64 partition scheme.

Type:SwitchParameter
Position:1
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-PlacementConstraint

Specifies the placement constraint for the service.

Type:String
Position:Named
Default value:None
Required:False
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
Required:False
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
Required:False
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
Required:False
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
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ServiceName

Specifies the URI of a Service Fabric service group.

Type:Uri
Position:3
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ServicePackageActivationMode

Controls the [hosting model][1] to be used for the service. Valid values are SharedProcess and ExclusiveProcess. The default is SharedProcess.

With SharedProcess activation mode, replicas (or instances) of different services of a given ServiceType will share same ServiceHost. With ExclusiveProcess activation mode, each replica or instance of a service will have its own dedicated ServiceHost. For more details, please see [Service Fabric Hosting Model][1].

Type:ServicePackageActivationMode
Accepted values:SharedProcess, ExclusiveProcess
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ServiceTypeName

Specifies the name of a Service Fabric service type.

Type:String
Position:4
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Stateful

Indicates that the service is a Service Fabric stateful service.

Type:SwitchParameter
Position:0
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Stateless

Indicates that the service is a Service Fabric stateless service.

Type:SwitchParameter
Position:0
Default value:None
Required:True
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
Required:True
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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

System.Object