Friday, March 24, 2017

cachehostinfo is null when starting distributed cache

An error comes up when we try to start the Distributed Cache Service on the Services on the Server page in the Central Administration. The error that comes up is "CacheHostInfo is null". This happens for particular server where we want to start the service. To troubleshoot the issue follow the below steps -


1> Login to the server for which this error had come up while starting the distributed cache.
2> Open the PowerShell ISE and run the below command
 
                 Get-SPServiceInstance -Server 
 
 3> Once we see the output, search for the Distributed Cache Service Instance. Get the ID associated to the Distributed Cache instance. once done, run the below command


          $s = get-spserviceinstance
          $s.Delete()


4> This will cleanup the distributed cache on that particular server.
5> For adding the server for the Distributed Cache, run the below powershell command

                  add-SPDistributedCacheServiceInstance -Verbose


6> For validation, one can check in the CA in Services on the Server page or run the below commands to check is distributed cache is running on the required servers
 Get-SPServiceInstance | ? {($_.service.tostring()) -eq “SPDistributedCacheService Name=AppFabricCachingService”} | select Server, Status