你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Update-ServiceFabricPartitionLoad

更新指定 Service Fabric 分区的负载。

语法

Update-ServiceFabricPartitionLoad
      [-PartitionMetricLoadDescriptionList] <System.Collections.Generic.List`1[System.Fabric.Description.PartitionMetricLoadDescription]>
      [-ContinuationToken <String>]
      [-TimeoutSec <Int32>]
      [<CommonParameters>]
Update-ServiceFabricPartitionLoad
      [-PartitionMetricLoadDescriptionList] <System.Collections.Generic.List`1[System.Fabric.Description.PartitionMetricLoadDescription]>
      [-GetSinglePage]
      [-ContinuationToken <String>]
      [-MaxResults <Int64>]
      [-TimeoutSec <Int32>]
      [<CommonParameters>]

说明

Update-ServiceFabricPartitionLoad cmdlet 按 PartitionMetricLoadDescriptionList指定更新 Service Fabric 分区的负载,然后返回结果。

在 Service Fabric 群集上执行任何操作之前,请使用 Connect-ServiceFabricCluster cmdlet 建立与群集的连接。

示例

示例 1:使用 Update-ServiceFabricParitionLoad 报告分区的各种负载

# This demonstrates various ways in which Update-ServiceFabricPartitionLoad can be used to report loads for a partition
# Part 1: reporting primary load for one or more metrics
# Part 2: reporting secondary load for one or more metrics
# Part 3: reporting loads for a given replica on a given node

# We need a guid object to identify the partition
$partitionIdString = '12345678-9012-4242-9876-432109876543'
$partitionId = [GUID]$partitionIdString

# Part 1: report primary load 42 for Metric0 and 43 for Metric1
$primaryLoad0 = New-Object -TypeName System.Fabric.Description.MetricLoadDescription('Metric0', 42)
$primaryLoad1 = New-Object -TypeName System.Fabric.Description.MetricLoadDescription('Metric1', 43)
$primaryLoads = New-Object 'System.Collections.Generic.List[System.Fabric.Description.MetricLoadDescription]'
$primaryLoads.Add($primaryLoad0)
$primaryLoads.Add($primaryLoad1)

# Part 2: report secondary load 5 for Metric0 and 6 for Metric1
$secondaryLoads = New-Object 'System.Collections.Generic.List[System.Fabric.Description.MetricLoadDescription]'
$secondaryLoad0 = New-Object -TypeName System.Fabric.Description.MetricLoadDescription('Metric0', 5)
$secondaryLoad1 = New-Object -TypeName System.Fabric.Description.MetricLoadDescription('Metric1', 6)
$secondaryLoads.Add($secondaryLoad0)
$secondaryLoads.Add($secondaryLoad1)

# Part 3a: for the replica on Node0 report a load of 42 for Metric0 and 24 for Metric1
$perNodeSecondaryLoads0 = New-Object 'System.Collections.Generic.List[System.Fabric.Description.MetricLoadDescription]'
$perNodeSecondaryLoad00 = New-Object -TypeName System.Fabric.Description.MetricLoadDescription('Metric0', 42)
$perNodeSecondaryLoad01 = New-Object -TypeName System.Fabric.Description.MetricLoadDescription('Metric1', 24)
$perNodeSecondaryLoads0.Add($perNodeSecondaryLoad00)
$perNodeSecondaryLoads0.Add($perNodeSecondaryLoad01)
$perNodeLoadsNode0 = New-Object -TypeName System.Fabric.Description.ReplicaMetricLoadDescription("Node0", $perNodeSecondaryLoads0)

# Part 3b: for the replica on Node1 report a load of 5 for Metric0 and 6 for Metric1
$perNodeSecondaryLoads1 = New-Object 'System.Collections.Generic.List[System.Fabric.Description.MetricLoadDescription]'
$perNodeSecondaryLoad10 = New-Object -TypeName System.Fabric.Description.MetricLoadDescription('Metric0', 5)
$perNodeSecondaryLoad11 = New-Object -TypeName System.Fabric.Description.MetricLoadDescription('Metric1', 6)
$perNodeSecondaryLoads1.Add($perNodeSecondaryLoad10)
$perNodeSecondaryLoads1.Add($perNodeSecondaryLoad11)
$perNodeLoadsNode1 = New-Object -TypeName System.Fabric.Description.ReplicaMetricLoadDescription("Node1", $perNodeSecondaryLoads1)

# Part 3c: put all node loads in an aggregate list
$perNodeLoads = New-Object 'System.Collections.Generic.List[System.Fabric.Description.ReplicaMetricLoadDescription]'
$perNodeLoads.Add($perNodeLoadsNode0)
$perNodeLoads.Add($perNodeLoadsNode1)

# Generate a description object which can contain all 3 load types (primary, secondary and per node)
# Empty dummy lists can be passed to the constructor if not all 3 types of reporting are used
$loadDescription = New-Object -TypeName System.Fabric.Description.PartitionMetricLoadDescription($partitionId, $primaryLoads, $secondaryLoads, $perNodeLoads)

# Create the final list of descriptions
# In this example we are reporting the load for a single partition
# But in general, more descriptions can be added to partitionMetricLoadDescriptionList
# This way, loads for multiple partitions can be reported through a single Update-ServiceFabricPartitionLoad call
$partitionMetricLoadDescriptionList = New-Object 'System.Collections.Generic.List[System.Fabric.Description.PartitionMetricLoadDescription]'
$partitionMetricLoadDescriptionList.Add($loadDescription)

# Finally, report the loads
Update-ServiceFabricPartitionLoad -PartitionMetricLoadDescriptionList $partitionMetricLoadDescriptionList

另请参阅 报告分区负载。

参数

-ContinuationToken

指定可用于检索下一页查询结果的延续标记。

如果结果过多而遵循提供的筛选器,则它们可能不适合一条消息。 分页通过将返回的结果集合拆分为单独的页面来考虑这一点。 延续标记用于知道上一页的离开位置,只对查询本身具有意义。 此值应从运行此查询生成,并且可以传递到下一个查询请求中,以便获取后续页面。 仅当有后续页面时,才会返回非 null 继续标记值作为结果的一部分。 如果未提供 -GetSinglePage 选项,则查询将返回从继续标记值开始的所有页面。

类型:String
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-GetSinglePage

指定查询是返回包含延续标记值的查询结果的一页,还是将所有页面组合成一个结果列表。 如果选择此选项,则查询调用方负责检查后续页面。

类型:SwitchParameter
Position:Named
默认值:None
必需:True
接受管道输入:False
接受通配符:False

-MaxResults

指定每个页面可返回的最大结果项数。 这定义了返回的结果数的上限,而不是最小值。 例如,如果页面根据配置中定义的最大消息大小限制最多容纳 1000 个返回的项目,并且 MaxResults 值设置为 2000,则即使 2000 个结果项与查询说明匹配,也只返回 1000 个结果。 此值需要选择 GetSinglePage 标志;否则将忽略它。

类型:Int64
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

-PartitionMetricLoadDescriptionList

PartitionMetricLoadDescription 指定特定 Service Fabric 分区的加载更新的对象的列表。

类型:System.Collections.Generic.List`1[System.Fabric.Description.PartitionMetricLoadDescription]
Position:0
默认值:None
必需:True
接受管道输入:True
接受通配符:False

-TimeoutSec

指定操作的超时期限(以秒为单位)。

类型:Int32
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

输入

System.Collections.Generic.List`1[[System.Fabric.Description.PartitionMetricLoadDescription, System.Fabric, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]

输出

System.Object