【Azure Service Fabric 】节点扩展状态为 Not Ready 的恢复办法

问题描述

Azure Service Fabric 节点无法启动时,扩展状态里的 Node configuration is in progress 很容易让人觉得“再等一会儿就好”。

但如果节点持续无法恢复,这条提示只能说明配置尚未完成,并不能证明配置仍在正常推进。

这次遇到的问题发生在 Windows 节点 node 0 上。

检查 Microsoft.Azure.ServiceFabric.ServiceFabricNode 扩展时,看到以下状态:

Type    Microsoft.Azure.ServiceFabric.ServiceFabricNode Display Status    Not Ready Handler Version    1.1.0.27 Status Code    ProvisioningState/NotReady/1 Status Level    Info Status Message    Node configuration is in progress

  • 1.1.0.27 是扩展处理程序版本,不是 Service Fabric 运行时版本。
  • Info 也不代表节点健康,它是这条扩展状态信息的级别,而 Not Ready 明确表示扩展尚未就绪。

那么,节点到底卡在什么环节?当重新映像这条恢复路径暂时走不通时,是否还有办法让节点配置继续完成?

问题解答

Service Fabric 节点启动涉及本机运行时安装、节点配置以及加入集群等,节点长期处于 Down 状态时,可能是引导过程中的某个步骤无法完成,例如配置节点、安装 Service Fabric 或重新加入集群。证书过期、磁盘空间不足等问题也可能阻碍启动。在

在这次的恢复方法中,采用了最暴力的办法,直接将节点中文件夹“C:\Program Files\Microsoft Service Fabric\bin”中的全部文件,Service Fabric集群就可以通过自动修复任务重新配置了节点。

执行的清理命令如下

# stop Service Fabric processes/services

sc stop ServiceFabricNodeBootstrapUpgradeAgent

sc stop ServiceFabricNodeBootstrapAgent

sc stop FabricHostSvc

sc query ServiceFabricNodeBootstrapAgent

# clean up runtime

dir "C:\Program Files\Microsoft Service Fabric"

dir "C:\Program Files\Microsoft Service Fabric\FabricInstallerService.Code"

cd "C:\Program Files\Microsoft Service Fabric"

move bin bin_moved

sc start FabricInstallerSvc

# restart vm to re-activate ServiceFabricNodeBootstrapAgent

shutdown /r
 

手动恢复的步骤为:

第一步:通过远程桌面的方式进入节点

第二步:停止相关服务,确认已经停止

依次执行:

sc  stop ServiceFabricNodeBootstrapUpgradeAgent sc  stop ServiceFabricNodeBootstrapAgent sc  stop FabricHostSvc

然后查询服务状态:

sc  query ServiceFabricNodeBootstrapUpgradeAgent sc  query ServiceFabricNodeBootstrapAgent sc  query FabricHostSvc

sc stop(即是sc.exe stop)发出停止请求,并不意味着服务已经停止。如果仍显示 STOP_PENDING,需要继续等待并重新查询,确认相关服务进入 STOPPED 后再继续。

第三步:检查目录,将原运行时目录移走

先检查安装目录和安装服务的代码目录:

dir "C:\Program Files\Microsoft Service Fabric"

dir "C:\Program Files\Microsoft Service Fabric\FabricInstallerService.Code"

确认目录与现场预期一致后,进入安装目录:

cd /d "C:\Program Files\Microsoft Service Fabric"

确认当前目录切换成功、源目录存在,且目标备份目录尚不存在,再执行:

move bin bin_moved

这一步的“清理”实际上是将原运行时目录重命名保留,不是直接删除文件。

保留下来的目录可以用于后续比对和取证,但它不是完整的节点备份,也不意味着恢复失败后可以无条件改名还原。

第四步:启动安装服务

sc start FabricInstallerSvc

第五步:重启目标虚拟机

shutdown /r

参考资料

Service-Fabric-Troubleshooting-Guides :https://github.com/Azure/Service-Fabric-Troubleshooting-Guides/blob/master/Cluster/Why%20is%20my%20node%20unhealthy.md#troubleshooting-node-stuck-in-down-state

Service Fabric managed cluster automatic node repair :https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-cluster-node-auto-repair

正在加载评论...