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

2 comments:

  1. The marked answer is absolutely correct and works. However, there is one thing that can be a nightmare to you and the suggested answer will not work.

    I had the same problem and my Distributed Cache was not working. The AppFabric cache stayed in Disabled state. Even after recreating the farm multiple times and clean installations, it didn't work. When i ran below command, it worked without any error. The GUID is the ID of the service. (See Marked Answer).

    $s = get-spserviceinstance GUID
    $s.delete()
    But when i tried to run below command, it said that the Host Name is already present in cluster.

    Add-SPDistributedCacheServiceInstance
    The below command didn't work for me even a single time.

    Remove-SPDistributedCacheServiceInstance
    I keep getting multiple wired error, i manually put the stuff in registry, force started the DCS in SharePoint and it took me nearly a month to troubleshoot the issue but still no result.

    Finally, i came to a blog and below commands helped to solve my issue. I had to manually Unregister cache host and and the add it again. It worked like a charm.

    Unregister-CacheHost -HostName "PROVIDE YOUR SERVER NAME"

    Provider Type : SPDistributedCacheClusterProvider

    I got provider type and connection string information from Registery
    Path - "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AppFabric\V1.0\Configuration"
    After running this, run the below command and things should work for you.

    Add-SPDistributedCacheServiceInstance
    I hope it will save someone's time.

    Cheers

    ReplyDelete
  2. Thanks for sharing your thoughts about %meta_keyword%. Regards

    ReplyDelete