SharePoint 2013移除服务器报错"CacheHostInfo is null"
笔者将一台SharePoint 场中的一台机器通过Configuration Wizard退了场. 当笔者想到管理中心去Remove Server的时候, 遇到了报错:
CacheHostInfo is null
上网搜索一下, 发现这篇文章. 写得非常好, 我把他的脚本运行了一遍, 解决了这个问题.
问题描述
===========================
ULS Log中的条目
06/06/2013 23:50:51.33 w3wp.exe (0x17AC) 0x067C SharePoint Foundation DistributedCache ajeou Unexpected A failure occurred in SPDistributedCacheServiceInstance::UnprovisionInternal. cacheHostInfo is null for host 'APP1'. 3cf9229c-3b22-2062-33bb-ec5a90a0419f
06/06/2013 23:50:51.33 w3wp.exe (0x17AC) 0x067C SharePoint Foundation DistributedCache ajeoy Unexpected A failure occurred SPDistributedCacheServiceInstance::UnprovisionInternal()... isGraceFulShutDown 'False' , isGraceFulShutDown, Exception 'System.InvalidOperationException: cacheHostInfo is null at Microsoft.SharePoint.DistributedCaching.Utilities.SPDistributedCacheServiceInstance.UnProvisionInternal(Boolean isGraceFulShutDown)' 3cf9229c-3b22-2062-33bb-ec5a90a0419f
06/06/2013 23:50:51.33 w3wp.exe (0x17AC) 0x067C SharePoint Foundation DistributedCache aelvg Unexpected A failure occurred SPDistributedCacheServiceInstance::UnProvision() , Exception 'System.InvalidOperationException: cacheHostInfo is null at Microsoft.SharePoint.DistributedCaching.Utilities.SPDistributedCacheServiceInstance.UnProvisionInternal(Boolean isGraceFulShutDown) at Microsoft.SharePoint.DistributedCaching.Utilities.SPDistributedCacheServiceInstance.Unprovision()' 3cf9229c-3b22-2062-33bb-ec5a90a0419f
06/06/2013 23:50:51.34 w3wp.exe (0x17AC) 0x067C SharePoint Foundation Runtime tkau Unexpected System.InvalidOperationException: cacheHostInfo is null at Microsoft.SharePoint.DistributedCaching.Utilities.SPDistributedCacheServiceInstance.UnProvisionInternal(Boolean isGraceFulShutDown) at Microsoft.SharePoint.DistributedCaching.Utilities.SPDistributedCacheServiceInstance.Unprovision() at Microsoft.SharePoint.Administration.SPServer.Delete() at Microsoft.SharePoint.WebControls.TopologyView.RemoveLink_Click(Object sender, CommandEventArgs e) at System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 3cf9229c-3b22-2062-33bb-ec5a90a0419f
解决方案
==================
脚本列在这里.
$SPFarm = Get-SPFarm $cacheClusterName = "SPDistributedCacheCluster_" + $SPFarm.Id.ToString() $cacheClusterManager = [Microsoft.SharePoint.DistributedCaching.Utilities.SPDistributedCacheClusterInfoManager]::Local $cacheClusterInfo = $cacheClusterManager.GetSPDistributedCacheClusterInfo($cacheClusterName) $instanceName ="SPDistributedCacheService Name=AppFabricCachingService" $serviceInstance = Get-SPServiceInstance | ? {($_.Service.Tostring()) -eq $instanceName -and ($_.Server.Name) -eq "APP1"} $serviceInstance.Delete() $cacheClusterInfo.CacheHostsInfoCollection
这里值得学习的是Get-SPServiceInstance的使用以及如何对其中的结果进行filter, 从而得到自己想要的service instance的用法.
排错中心思想很简单, 已经退场的服务器APP1上还有Distribution Cache服务的注册信息没有清理干净. 需要找到这个service instance, 删掉它.
参考资料
==============================
Cannot Remove Server Reference from Farm CacheHostInfo is null
http://summit7systems.com/cannot-remove-server-reference-from-farm-cachehostinfo-is-null/