Tuesday, March 25, 2014

SharePoint 2013 Distributed Cache error "cachehostinfo is null"

Doing a fresh SharePoint 2013 SP1 deployment, I ran into a couple things I want to remember.

1)  SharePoint 2013 RTM won't install on Windows Server 2012 R2.  You must install using SharePoint 2013 WITH SP1.

2)  Somehow after configuring things, the distributed cache service wouldn't run on one of the hosts.  The error was "cachehostinfo is null".   Advice I got was to remove the service instance and re-add it, but even trying to run "Remove-SPDistributedCacheServiceInstance" came back with that.  The following powershell script allows you to remove the service instance on the machine you're on, which then frees you up to run add-spdistributedcacheserviceinstance.

Originally from StackExchange:

$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 $env:computername}  
$serviceInstance.Delete()   #You may have to issue the Delete command a couple of times.