none
SharePoint 2013 Distributed Cache “cacheHostInfo is null” with “Remove-SPDistributedCacheServiceInstance”

    Question

  • I am attempting to remove a server as a cache host in my SharePoint 2013 environment.

    Currently the service shows as Stopped on the server that I am attempting to remove from the cache cluster.  I also am getting a warning in Central Administration stating:

    "This Distributed Cache host may cause cache reliability problems.

    This Distributed Cache service on this Distributed Cache host has been stopped but not unregistered from the farm. In order to avoid reliability issues, it is recommended that a Distributed Cache host with a stopped Distributed Cache service be unregistered from the farm."

    I run the command from PowerShell:

    Remove-SPDistributedCacheServiceInstance
    It errors out saying:

    "cacheHostInfo is null"

    Looking in the ULS logs I see this:

    "A failure occurred in SPDistributedCacheServiceInstance::UnprovisionInternal. cacheHostInfo is null for host 'server_name'."

    When I open the AppFabric Server Configuration Wizard on the server it states:

    "This machine is not a member of an AppFabric Caching cluster."

    I'm looking mainly to remove the service from that server since I have no plans of running the Distributed Cache on there anyways but I can't find my way around this error.

    Any help would be appreciated.

    Thanks.

    Tuesday, January 29, 2013 11:07 PM

Answers

  • I think I figured out a fix to the problem.

    To speed up the process (and cut corners apparently) I had installed the pre-reqs and the SharePoint 2013 install on a vm and then performed a sysprep on it and created a vm image template so I could make quick copies for the other web and application tier servers.  After creating the copies I ran the Configuration Wizard to add the servers to the farm.

    I'm thinking that a configuration was made during the AppFabric install or the SharePoint files install that either the sysprep took out, or because I used a pre-installed image the AppFabric configuration was not unique to each vm I added to the environment.

    Regardless, it somehow made it so the cacheHostInfo became null.  Editing the registry location with the correct information , running PowerShell commands to manually register the broken vm to the AppFabric cluster, or directly editing the config files in the Program Files\App Fabric directory didn't solve the cacheHostInfo is null problem.

    So, the fix was to build base Windows Server 2008 R2 servers and run the pre-reqs and installation manually on each vm and then add it to the farm.  After running the Configuration Wizard the servers added themselves to the Distributed Cache cluster and started up fine with no errors.

    If someone knows where that variable is held in the environment I'd still appreciate an answer as to where it might be.


    • Marked as answer by Dan Sarà Friday, February 01, 2013 7:01 PM
    • Edited by Dan Sarà Friday, February 01, 2013 7:07 PM
    Friday, February 01, 2013 7:01 PM

All replies

  • Did you stop it using the Windows Services applet or the SharePoint Central Admin site?

    Chris Givens CEO, Architecting Connected Systems Blog Twitter

    Wednesday, January 30, 2013 4:12 AM
  • I had similar issue, and I don't know if I had resolved it. The farm is broken now since I had run a rename-spserver command for the farm configuration database server.

    My problem is caused by join my SharePoint server to another two-way trusted Active Directory domain (so, different FQDN) without disconnecting from the farm first.

    What follows is my findings:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AppFabric contains the provider and connection string setting. The provider is SPDistributedCacheClusterProvider , The connection string is something like:

    Data Source=win-citkf3c8r0o.guyuming.com\sql2012;Initial Catalog=SharePoint_Config2013RTM;Integrated Security=True;Enlist=False

    The GUI tool:  http://blogs.msdn.com/b/prathul/archive/2012/02/01/now-available-appfabric-1-1-caching-gui-administrator.aspx helps to visualize the administration. And it will display the powershell used. You can export the cache cluster configuration, remove the cache hosts, and import it back.

    And I had used the following PowerShell:

    $f=get-spfarm

    $cacheClusterName="SPDistributedCacheCluster"+$f.id.tostring()

    $cacheClusterManager=[microsoft.sharepoint.distributedcaching.utilities.SPDistributedCacheClusterInfoManager]::local

    $cacheClusterInfo=$cacheClusterManager.GetSPDistributedCacheClusterInfo($cacheClusterName)

    Most probably, $cacheClusterInfo.CacheHostsInfoCollection does not contain the host. So, "cacheHostInfo is null" is returned.

    You can take a look at the Microsoft.sharepoint.distributedcaching.utilities namespace in Microsoft.sharepoint.dll



    Wednesday, January 30, 2013 8:36 AM
  • It stopped on it's own after I joined the server to the farm.  My plan was to not have it run on the server it stopped on anyways but now I can't remove it all together from that server.
    Wednesday, January 30, 2013 5:35 PM
  • I checked the Registry location that you mentioned and found that there seems to be registry information missing (which, like you said, is probably contributing to the null value).

    On the server that is having problems under

    HKLM\SOFTWARE\Microsoft\AppFabric\V1.0\Configuration

    AdminConfigured and ServiceConfigured is equal to 0

    ConnectionString and Provider are both empty.

    On the server that is working:

    AdminConfigured and ServiceConfigured are both equal to 1

    ConnectionString is equal to "Data Source=SPSQL;Initial Catalog=SharePoint_Config;Integrated Security=True;Enlist=False"

    Provider is equal to "SPDistributedCacheClusterProvider"

    Is it possible to set the Registry settings manually on the non-working server to values so I can at least remove the cache host from the cluster or would that create problems with the server?

    Or should I use the tool you linked, export the settings on the working server, replace the cacheHostName, and then import them on the server that is not working?
    • Edited by Dan Sarà Wednesday, January 30, 2013 6:08 PM
    Wednesday, January 30, 2013 5:58 PM
  • I think I figured out a fix to the problem.

    To speed up the process (and cut corners apparently) I had installed the pre-reqs and the SharePoint 2013 install on a vm and then performed a sysprep on it and created a vm image template so I could make quick copies for the other web and application tier servers.  After creating the copies I ran the Configuration Wizard to add the servers to the farm.

    I'm thinking that a configuration was made during the AppFabric install or the SharePoint files install that either the sysprep took out, or because I used a pre-installed image the AppFabric configuration was not unique to each vm I added to the environment.

    Regardless, it somehow made it so the cacheHostInfo became null.  Editing the registry location with the correct information , running PowerShell commands to manually register the broken vm to the AppFabric cluster, or directly editing the config files in the Program Files\App Fabric directory didn't solve the cacheHostInfo is null problem.

    So, the fix was to build base Windows Server 2008 R2 servers and run the pre-reqs and installation manually on each vm and then add it to the farm.  After running the Configuration Wizard the servers added themselves to the Distributed Cache cluster and started up fine with no errors.

    If someone knows where that variable is held in the environment I'd still appreciate an answer as to where it might be.


    • Marked as answer by Dan Sarà Friday, February 01, 2013 7:01 PM
    • Edited by Dan Sarà Friday, February 01, 2013 7:07 PM
    Friday, February 01, 2013 7:01 PM
  • Very interesting...thanks for sharing!

    Chris Givens CEO, Architecting Connected Systems Blog Twitter

    Friday, February 01, 2013 7:19 PM
  • I got same error with you and I find out the answer, I hope what I did can help you

    http://rakasatria.wordpress.com/2013/02/04/sharepoint-2013-spdistributedcacheserviceinstance-cachehostinfo-is-null/


    Best Regards,

    raka.satria


    A person who never made a mistake never tried anything new - Albert Einstein


    Monday, February 04, 2013 7:18 AM
  • looks good, i would try if i can reconnect to my "broken" farm. Mark to give credit first.
    Monday, February 04, 2013 7:38 AM
  • i run the above powershell again in a working farm, the $cacheClusterInfo.CacheHostsInfoCollection always return nothing now. I guess SharePoint has made change in this. The work farm is SharePoint 2013 RTM with 2013 march PU and 2013 april CU. And i had applied latest CU for appfabric distributed cache.
    Wednesday, July 03, 2013 5:03 AM
  • I got the same error resolved it by following steps

    1)Removed cachehost from cluster using

    http://rakasatria.wordpress.com/2013/02/04/sharepoint-2013-spdistributedcacheserviceinstance-cachehostinfo-is-null/.

    2)Added the instance by

    Add-SPDistributedCacheServiceInstance

    3)I was not able to start the service coz of memory issue so i updated the cache size by using update command

    4)i tried running command

    Get-CacheHost

    and the cache was running,

    initially when i tries using remove command i was getting "cacheHostInfo is null" error so i used the scripts to remove it

    • Proposed as answer by Aditya Gandhe Wednesday, August 14, 2013 11:23 AM
    Wednesday, August 14, 2013 11:08 AM