共用方式為


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>]

Description

Update-ServiceFabricPartitionLoad Cmdlet 會更新 Service Fabric 分割區的負載,如透過 PartitionMetricLoadDescriptionList指定,然後傳回結果。

在 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