Cannot Remove Server Reference from Farm CacheHostInfo is null
CacheHost

Cannot Remove Server Reference from Farm CacheHostInfo is null

Posted by on Friday, April 12th, 2013  

 

I am beginning to believe that the Distributed Cache Service in SharePoint Server 2013 will replace the User Profile Service in SharePoint 2010 as the service most hated by SharePoint administrators.

Last week, when working with a test farm on virtual machines, I encountered a problem starting the Distributed Cache Service on a farm member. Since I needed to modify the server architecture to test moving services anyway, I just left the service stopped and ran the configuration wizard to remove the server from the farm. BAD MISTAKE!

While I was at it, I used the configuration wizard to remove a second server from the farm which was also running the Distributed Cache Service. SECOND BAD MISTAKE!

First clue that I had problems was that deployed solutions that were previously working fine suddenly were not working. I had been testing Smartlogic Semaphore ontology management and auto classification services which are deployed as SharePoint solutions. Some still worked fine. Others had features removed and were dysfunctional. Seems some SharePoint operations need Distributed Cache and others do not although that was not evident as the problem at this point.

I checked Farm Solution deployments. All three displayed that they were not deployed on the Solution Management page. However on the individual Solution Properties pages, they all showed as successfully deployed. Very strange indeed.

I tried forcing deployment with PowerShell:

 Install-SPSolution –Force –GACDeployment

and other appropriate switches. Not happening. Seems that solution deployment needs an operative Distributed Cache although that was not evident as the problem at this time.

Checked the Smartlogic Semaphore Application Service and all seem active and operational.

Checked the Services on Servers page and all the appropriate services were running as expected on the only farm member. For some reason, went to change the server on the Services on Servers page and found that the two servers which I had removed were still listed. Selected each of the non-existent servers and found that they were running the Distributed Cache Service. Well, actually the services were the only ones listed but they were not running. Obviously, they would not start because the servers did not exist!

Opened the Servers in the Farm page and found that the servers were still listed as farm members.

Reset IIS. (After all, I am a SharePoint administrator.) Nothing changed.

Rebooted the server. (After all, I am a Windows Server administrator.) Nothing changed.

On Servers in the Farm page, I tried to remove the servers manually, agreeing to all the dire warnings. Got the dreaded message: CacheHostInfo is null. 

Raka Satria has an excellent blog post on this issue at http://rakasatria.wordpress.com/2013/02/04/sharepoint-2013-spdistributedcacheserviceinstance-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.

Happy Sharing with SharePoint 2013!

 

Disclaimer
The sample scripts are not supported under any Summit 7 Systems standard support program or service. The sample scripts are provided AS IS without warranty of any kind. Summit 7 Systems further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Summit 7 Systems, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Summit 7 Systems has been advised of the possibility of such damages.

Subscribe to RSS Feed

Sign Up for Newsletter

6

6

comments

    Apr 12
    2013

    Raka Satria

    Nice share 🙂

    Reply
    Jun 27
    2013

    JHG

    Merci!! I had the same Problem… but now i´s solved!

    Reply
    Aug 02
    2013

    Ralf

    I think you just saved my holiday and Distributed Cache which was irrecoverably poked!

    Reply
    Sep 24
    2014

    Am@r

    I am able to solve my problem thx for post.

    Reply
    Sep 23
    2016

    Rob Garrett

    Dude, this saved me lots of hair pulling.

    Thanks,

    Rob Garrett

    Reply

Leave a Reply