管理者モードの Powershell で
PS C:\Windows\system32> Stop-Service FabricHostSvc -WarningAction SilentlyContinue
PS C:\Windows\system32> Remove-Item C:\SfDevCluster\Data -Force -Recurse
PS C:\Windows\system32> notepad C:\SfDevCluster\Manifests\<your machine name>-Server-ScaleMin.xml
notepad で適当にいじる、試しに NodeList を削って 3 ノードにしてみた。
<Infrastructure>
<WindowsServer IsScaleMin="true">
<NodeList>
<Node NodeName="Node.1" IPAddressOrFQDN="localhost" IsSeedNode="true" NodeTypeRef="NodeType1" FaultDomain="fd:/FD01" UpgradeDomain="UD1" />
<Node NodeName="Node.2" IPAddressOrFQDN="localhost" IsSeedNode="true" NodeTypeRef="NodeType2" FaultDomain="fd:/FD02" UpgradeDomain="UD2" />
<Node NodeName="Node.3" IPAddressOrFQDN="localhost" IsSeedNode="true" NodeTypeRef="NodeType3" FaultDomain="fd:/FD03" UpgradeDomain="UD3" />
</NodeList>
</WindowsServer>
</Infrastructure>
構成を確認させる。
PS C:\Windows\system32> $ManifestFile = "C:\SfDevCluster\Manifests\<your machine name>-Server-ScaleMin.xml"
PS C:\Windows\system32> $FabricDataRoot ="C:\SfDevCluster\Data"
PS C:\Windows\system32> $FabricLogRoot = "C:\SfDevCluster\Log"
PS C:\Windows\system32> Test-ServiceFabricClusterManifest -ClusterManifestPath "$ManifestFile"
False
Test-ServiceFabricClusterManifest : Cluster manifest validation failed with exception System.ArgumentException: In cluster manifest/infrastructure manifest, the value of ExpectedClusterSize must be smaller than the number
of nodes. Currently, the ExpectedClusterSize is 4 while the node count is 3.
場所 System.Fabric.Management.WindowsFabricValidator.FabricSettingsValidator.VerifyExpectedClusterSize()
場所 System.Fabric.Management.WindowsFabricValidator.FabricSettingsValidator.ValidateSettings()
場所 System.Fabric.Management.WindowsFabricValidator.FabricValidator.Validate()
場所 System.Fabric.FabricDeployer.FabricValidatorWrapper.ValidateAndEnsureDefaultImageStore()
発生場所 行:1 文字:1
+ Test-ServiceFabricClusterManifest -ClusterManifestPath "$ManifestFile ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Test-ServiceFabricClusterManifest], ClusterManifestValidationException
+ FullyQualifiedErrorId : TestClusterManifestErrorId,Microsoft.ServiceFabric.Powershell.TestClusterManifest
怒られたらマニフェストを直す ExpectedClusterSize を 3に下げてみた
<Section Name="FailoverManager">
<!-- expected cluster size allows the placement to start when the cluster is started. This value should be less than total number of nodes
as without it the FailoverManager will not start the placement of the user services. This value should be 80% to 90% of the cluster size.
-->
<Parameter Name="ExpectedClusterSize" Value="3" />
<!-- The default target and min replica set sizes are 7 and 5. The below configuration is not required for cluster that have 7 or more nodes. -->
<Parameter Name="TargetReplicaSetSize" Value="5" />
<Parameter Name="MinReplicaSetSize" Value="3" />
<Parameter Name="ReconfigurationTimeLimit" Value="20" />
<Parameter Name="BuildReplicaTimeLimit" Value="20" />
<Parameter Name="CreateInstanceTimeLimit" Value="20" />
<Parameter Name="PlacementTimeLimit" Value="20" />
</Section>
Test-ServiceFabricClusterManifest を通したら New-ServiceFabricNodeConfiguration で構成を反映する。
PS C:\Windows\system32> Test-ServiceFabricClusterManifest -ClusterManifestPath "$ManifestFile"
True
PS C:\Windows\system32> New-ServiceFabricNodeConfiguration -ClusterManifest "$ManifestFile" -FabricDataRoot "$FabricDataRoot" -FabricLogRoot "$FabricLogRoot"
Create node configuration succeeded
うまくいったら Service Fabric を起動する。
PS C:\Windows\system32> Start-Service FabricHostSvc -WarningAction SilentlyContinue
うまく構成されたか確認する為につないで調べてみる。
PS C:\Windows\system32> Connect-ServiceFabricCluster -ConnectionEndpoint localhost:19000
True
警告: Cluster connection with the same name already existed, the old connection will be deleted
ConnectionEndpoint : {localhost:19000}
FabricClientSettings : {
ClientFriendlyName : PowerShell-6d6ad8d8-89e5-4f65-ab20-2c2129ca9f3b
PartitionLocationCacheLimit : 100000
PartitionLocationCacheBucketCount : 1024
ServiceChangePollInterval : 00:02:00
ConnectionInitializationTimeout : 00:00:02
KeepAliveInterval : 00:00:20
HealthOperationTimeout : 00:02:00
HealthReportSendInterval : 00:00:00
HealthReportRetrySendInterval : 00:00:30
NotificationGatewayConnectionTimeout : 00:00:00
NotificationCacheUpdateTimeout : 00:00:00
}
GatewayInformation : {
NodeAddress : localhost:19000
NodeId : a4015a3ca36022407403daa2cc47ea75
NodeInstanceId : 130844441960155051
NodeName : Node.1
}
PS C:\Windows\system32> Get-ServiceFabricNode | ft -Property NodeName, FaultDomain, UpgradeDomain, NodeStatus, HealthState -AutoSize
NodeName FaultDomain UpgradeDomain NodeStatus HealthState
-------- ----------- ------------- ---------- -----------
Node.1 fd:/FD01 UD1 Up Ok
Node.2 fd:/FD02 UD2 Up Ok
Node.3 fd:/FD03 UD3 Up Ok
PS C:\Windows\system32>
うまく3ノードになったので構成をいじる事ができたようだ。