ServiceFabric极简文档-1.1 附属文件:规划和准备 Service Fabric 独立群集部署

准备好要充当节点的计算机

下面是要添加到群集的每台计算机的建议规格:

至少 16 GB RAM
至少 40 GB 可用磁盘空间
4 核或更高规格的 CPU
所有计算机与安全网络连接
Windows Server 2012 R2 或 Windows Server 2016
.NET Framework 4.5.1 或更高版本的完整安装版
Windows PowerShell 3.0
应在所有计算机上运行 RemoteRegistry 服务

部署和配置群集的群集管理员必须拥有每台计算机的管理员权限。 不能在域控制器上安装 Service Fabric。

下载适用于 Windows Server 的 Service Fabric 独立包

下载链接 - Service Fabric 独立包 - Windows Server,并将包解压缩到群集外的一台部署计算机中或解压缩到群集内的其中一台计算机中。

修改群集配置

若要创建一个独立群集,则必须创建一个独立群集配置 ClusterConfig.json 文件,并在其中说明该群集的规范。 可根据以下链接中的模板创建配置文件。

独立群集配置

从已下载的程序包中打开某个 ClusterConfig.json 文件,并修改以下设置:

配置设置说明
NodeTypes 节点类型可让你将群集节点划分到不同的组中。 一个群集必须至少有一个节点类型。组中的所有节点具有以下共同特征:名称-即节点类型名称。终结点端口 - 即与此节点类型关联的各种命名终结点(端口)。 可以使用任何端口号,只要它们不会与此清单中的其他部分发生冲突,并且未被计算机/VM上运行的其他应用程序使用。放置属性-即此节点类型的相应属性,可用作系统服务或你的服务的放置约束。这些属性是用户定义的键/值对,可为指定节点提供额外的元数据。节点属性的示例包括节点是否有硬盘或图形卡、其硬盘的轴数、内核数和其他物理属性。容量-节点容量,定义特定节点提供的特定资源的名称和数量。例如,节点可以定义名为“MemoryInMb”的指标容量,而且默认有 2048 MB的可用内存。这些容量在运行时使用,以确保将需要特定资源量的服务放在具有所需数量的可用资源的节点上。IsPrimary-如果定义了多个NodeType,请确保只有一个设置为主节点(值为true),系统服务会在该主节点上运行。 应将所有其他节点类型设置为 false 值
Nodes 这些是群集内的每个节点的详细信息(节点类型、节点名称、IP 地址、节点的容错域和升级域)。 要在其上创建群集的计算机必须与其 IP 地址一起列在此处。如果对所有节点使用相同的 IP 地址,则会创建一个可用于测试的单机群集。 不要将单机群集用于部署生产工作负荷。

群集配置将所有设置配置到环境后,可针对群集环境对其进行测试(步骤 7)。

环境设置

群集管理员配置 Service Fabric 独立群集时,需按照以下准则设置环境:

  1. 对于群集配置文件中列出的所有计算机,创建群集的用户应对它们具有管理员级别的安全特权。
  2. 从中创建群集的计算机和每个群集节点计算机必须:
  3. 已卸载 Service Fabric SDK
  4. 已卸载 Service Fabric 运行时
  5. 已启用 Windows 防火墙服务 (mpssvc)
  6. 已启用远程注册表服务 (remoteregistry)
  7. 已启用文件共享 (SMB)
  8. 已基于群集配置端口打开所需的端口
  9. 已打开 Windows SMB和远程注册表服务所需的端口:135、137、138、139 和 445
  10. 已相互建立网络连接
  11. 所有群集节点计算机均不是域控制器。
  12. 如果要部署的群集是安全群集,需确保存在所需的安全先决条件,且已针对配置进行了正确配置。
  13. 如果群集计算机无法访问 Internet,请在群集配置中进行以下设置:
  14. 禁用遥测:在“属性”下,设置 “enableTelemetry”: false
  15. 禁用自动下载Fabric版本和禁用通知当前群集版本支持即将终止:在“属性”下,设置”fabricClusterAutoupgradeEnabled”: false
  16. 或者,如果网络Internet访问仅限于白名单中的域,则需要自动升级以下域:o.microsoft.com download.microsoft.com
  17. 设置适当的 Service Fabric 防病毒排除项:

防病毒排除的目录

Program FilesMicrosoft Service Fabric
FabricDataRoot(从群集配置中)
FabricLogRoot(从群集配置中)
防病毒排除的进程
Fabric.exe
FabricHost.exe
FabricInstallerService.exe
FabricSetup.exe
FabricDeployer.exe
ImageBuilder.exe
FabricGateway.exe
FabricDCA.exe
FabricFAS.exe
FabricUOS.exe
FabricRM.exe
FileStoreService.exe
使用 TestConfiguration 脚本验证环境

TestConfiguration.ps1 脚本位于独立包中。 该脚本可用作最佳做法分析器,验证上述部分标准,并应用作健全性检查,验证是否可在给定环境中部署群集。 如果出现任何故障,请参阅环境设置下的列表进行故障排除。

可以在对群集配置文件中列为节点的所有计算机具有管理员访问权限的任何计算机上运行此脚本。 运行此脚本的计算机不一定是群集的一部分。

PS C:	empMicrosoft.Azure.ServiceFabric.WindowsServer> .TestConfiguration.ps1 -ClusterConfigFilePath .ClusterConfig.Unsecure.DevCluster.json

Trace folder already exists. Traces will be written to existing trace folder: C:	empMicrosoft.Azure.ServiceFabric.WindowsServerDeploymentTraces
Running Best Practices Analyzer...
Best Practices Analyzer completed successfully.

LocalAdminPrivilege        : True
IsJsonValid                : True
IsCabValid                 : True(如果为空也可以)
RequiredPortsOpen          : True
RemoteRegistryAvailable    : True
FirewallAvailable          : True
RpcCheckPassed             : True
NoConflictingInstallations : True
FabricInstallable          : True
Passed                     : True

目前,此配置测试模块不会验证安全配置,因此必须单独执行验证。

创建群集
.CreateServiceFabricCluster.ps1 -ClusterConfigFilePath .ClusterConfig.Unsecure.DevCluster.json -AcceptEULA

实际操作:

PS C:UsersAdministrator> cd 'C:Microsoft.Azure.ServiceFabric'

PS C:Microsoft.Azure.ServiceFabric> .CreateServiceFabricCluster.ps1 -ClusterConfigFilePath .ClusterConfig.Unsecure.MultiMachine.json -AcceptEULA
Trace folder already exists. Traces will be written to existing trace folder: C:Microsoft.Azure.ServiceFabricDeploymentTraces
Runtime package version 6.0.232.9494 was not found in DeploymentRuntimePackages folder and needed to be downloaded.
Runtime package has been successfully downloaded to C:Microsoft.Azure.ServiceFabricDeploymentRuntimePackagesMicrosoftAzureServiceFabric.6.0.232.9494.cab.
Creating Service Fabric Cluster...
If it's taking too long, please check in Task Manager details and see if Fabric.exe for each node is running. If not, please look at: 1. traces in DeploymentTraces directory and 2. traces in FabricLogRoot 
configured in ClusterConfig.json.
Trace folder already exists. Traces will be written to existing trace folder: C:Microsoft.Azure.ServiceFabricDeploymentTraces
Running Best Practices Analyzer...
Best Practices Analyzer completed successfully.
Creating Service Fabric Cluster...
Processing and validating cluster config.
Configuring nodes.
Default installation directory chosen based on system drive of machine '10.0.0.217'.
Copying installer to all machines.
Configuring machine '10.0.0.217'.
Configuring machine '10.0.0.219'.
Configuring machine '10.0.0.216'.
Machine 10.0.0.219 configured.
Machine 10.0.0.217 configured.
Machine 10.0.0.216 configured.
Running Fabric service installation.
Successfully started FabricInstallerSvc on machine 10.0.0.219
Successfully started FabricInstallerSvc on machine 10.0.0.217
Successfully started FabricInstallerSvc on machine 10.0.0.216
Successfully started FabricHostSvc on machine 10.0.0.216
Successfully started FabricHostSvc on machine 10.0.0.219
Successfully started FabricHostSvc on machine 10.0.0.217
Your cluster is successfully created! You can connect and manage your cluster using Microsoft Azure Service Fabric Explorer or Powershell. To connect through Powershell, run 'Connect-ServiceFabricCluster [
ClusterConnectionEndpoint]'.
Runtime package version 6.0.232.9494 was not found in DeploymentRuntimePackages folder and needed to be downloaded.
Runtime package has been successfully downloaded to C:Microsoft.Azure.ServiceFabricDeploymentRuntimePackagesMicrosoftAzureServiceFabric.6.0.232.9494.cab.

PS C:Microsoft.Azure.ServiceFabric>
  1. 在创建群集时自动下载和安装 Service Fabric 运行时包。
  2. 一台部署安装部署,会自动部署至其他节点
连接至群集
Connect-ServiceFabricCluster -ConnectionEndpoint localhost:19000
使用 Service Fabric Explorer 可视化群集

Service Fabric Explorer是一项很好的工具,适用于可视化群集和管理应用程序。 Service Fabric Explorer 是一项在群集中运行的服务,使用浏览器导航到 http://localhost:19080/Explorer 即可访问该服务。

原文地址:https://www.cnblogs.com/CharlesZHENG/p/8625729.html