Wednesday, September 24, 2014

Cannot Remove Server Reference from Farm CacheHostInfo is null

He states “We can’t provision, unprovision, start, or stop a Cache Service because we still have a Cache Service that has no server attached.”
Not exactly my problem, as I had a Cache Service that seemed to have two non-existent servers semi-attached. But his Scripts were the starting point for resolving my issue. I ran them in this order:
Need the Farm name:


$SPFarm = Get-SPFarm


Need the Cache Name:


$cacheClusterName = "SPDistributedCacheCluster_" + $SPFarm.Id.ToString()


Need to use local (only) server as ClusterManager:


$cacheClusterManager = [Microsoft.SharePoint.DistributedCaching.Utilities.SPDistributedCacheClusterInfoManager]::Local


Need the Cluster name:

$cacheClusterInfo = $cacheClusterManager.GetSPDistributedCacheClusterInfo($cacheClusterName)


Need the Instance name:

$instanceName ="SPDistributedCacheService Name=AppFabricCachingService"


Need the service instance for the missing <computername>

$serviceInstance = Get-SPServiceInstance | ? {($_.Service.Tostring()) -eq $instanceName -and ($_.Server.Name) -eq "<computername>"}


Need to delete the instance reference:


$serviceInstance.Delete()


Repeat last two steps for second non-existent server.
Set new information: 
$cacheClusterInfo.CacheHostsInfoCollection
Just for good measure, on the Services on Servers page, stopped and started Distributed Cache Service. 
Then went to Servers in the Farm page and manually remove the servers successfully.
Back in PowerShell console, I used Install-SPSolution to manually redeploy the solutions again even though they displayed as deployed on Solutions Management page.
Everything is back and working correctly
For your farm you may need to re-add instances of the Distributed Cache Service on existing servers in your farm with PowerShell:
Add-SPDistributedCacheServiceInstance
At least I am learning. The last time the Distributed Cache Service was corrupted, I just gave up and re-built my farm.




Ref:
http://summit7systems.com/cannot-remove-server-reference-from-farm-cachehostinfo-is-null/#comment-1962





No comments:

Post a Comment