none
Having trouble getting distrubuted cache working RRS feed

  • Question

  • A few days ago I had a user that was having trouble using Office Online Server to modify documents.  It was only this user that was having the issue.  I started digging and realized that the user profile syncronization wasn't running.  Through some error I found in either the event log or the ULS logs that seemed to point as distributed cache being the issue.  I'm not sure if this is the solution to the user profile service not running or not but there does appear to be something wrong with the distrubted cache

    At this point I have ran so many powershell commands that I couldn't tell you what all I did.  When I try to run the provision I get "cacheHostInfo is null". Here are the results of my service queries.  Can anyone tell me next steps in diagnosing this?

    PS C:\Windows\system32> get-CacheHost

    HostName : CachePort                   Service Name            Service Status Version Info
    --------------------                   ------------            -------------- ------------
    server:22233 AppFabricCachingService DOWN           3 [3,3][1,3]



    PS C:\Windows\system32> Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName}

    TypeName                         Status   Id                                  
    --------                         ------   --                                  
    Distributed Cache                Disabled c1185386-2f29-4f0f-9475-b93ed4ebd47b




    Wednesday, December 18, 2019 2:32 PM

Answers

All replies

  • Hi,

    Per my understanding, the Distributed Cache service/App Fabric Caching Service is not running on your SharePoint server.

    Since we don’t really know what PowerShell commands you have already run, I will provide some basic troubleshooting steps as following:

    1. Navigate to Central Administration > System Settings > Manage Services on Server and manually start Distributed Cache.

    Make sure the service account under which AppFabric Caching Service is running is in the Local Administrator group.

    2. On the SharePoint Server, run the PowerShell commands below as Administrator to start the Distributed Cache service.

    $instanceName ="SPDistributedCacheService Name=AppFabricCachingService"
    $serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}
    $serviceInstance.Provision()

    3. If the service is still down, run the commands below to remove and then re-add the Distributed Cache Service instance.

    $instanceName ="SPDistributedCacheService Name=AppFabricCachingService"
    $serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}
    $serviceInstance.Unprovision() 
    $serviceInstance.Delete()
    
    Add-SPDistributedCacheServiceInstance

    4. Verify the service status again with the commands below.

    Use-CacheCluster
    Get-CacheHost

    Here’s your reference.

    Manage the Distributed Cache service in SharePoint Server.

    https://docs.microsoft.com/en-us/sharepoint/administration/manage-the-distributed-cache-service

    Best regards,

    Chelsea Wu


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Thursday, December 19, 2019 7:34 AM
  • Thanks.  I did try to unprovision then reprovision and as well as the other commands listed there.  I get back the same result.  Down and Disabled.  Here is a list of the commands I have in my powershell ISE in no particular order if that helps.  I should have done a better job of organizing these as I tried them but I didn't.  Hopefully this gives you an idea.  

    Add-PSSnapin Microsoft.SharePoint.PowerShell
    Import-Module  DistributedCacheConfiguration

    Get-SPServiceInstance | ? {($_.service.tostring()) -eq "SPDistributedCacheService Name=AppFabricCachingService"} | select Server, Status

    Unregister-CacheHost -HostName Server1 -ProviderType SPDistributedCacheClusterProvider -ConnectionString \\Server1
    Register-CacheHost -Provider "SPDistributedCacheClusterProvider" -ConnectionString "Data Source=Sharepoint-AOG;Initial Catalog=SharePoint_Config2012;Integrated Security=True;Enlist=False" -Account "mitech\spfarm" -CachePort 22233 -ClusterPort 22234 -ArbitrationPort 22235 -ReplicationPort 22236 -HostName Server1
    Start-CacheHost -ComputerName Server1 -CachePort 22233
    Restart-CacheCluster

    Unregister-CacheHost -provider "System.Data.SqlClient" -conn "Data Source=Sharepoint-AOG;Initial Catalog=SharePoint_Config2012;Integrated Security=True;Enlist=False"

    Remove-SPDistributedCacheServiceInstance
    Add-SPDistributedCacheServiceInstance

    $instanceName ="SPDistributedCacheService Name=AppFabricCachingService"
    $serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName}

    $serviceInstance.provision()
    $serviceInstance.Delete()



    $s = Get-SPServiceInstance c1185386-2f29-4f0f-9475-b93ed4ebd47b
    $s.delete()


    Use-CacheCluster

    get-CacheHost
    Get-SPServiceInstance | ? {($_.service.tostring()) -eq "SPDistributedCacheService Name=AppFabricCachingService"} | select Server, Status

    $registryHive = "HKLM:SOFTWARE\Microsoft\AppFabric\V1.0\Configuration"
    $connectionStringValueName = "ConnectionString"
    $connectionStringValue= "Data Source=Sharepoint-AOG;Initial Catalog=SharePoint_Config2012;Integrated Security=True;Enlist=False"
    $providerValueName = "Provider"
    $providerValue= "System.Data.SqlClient"

    if ((Test-Path $registryHive) -eq $false)
    {
    New-Item $registryHive -Force | Out-Null
    }
    Set-ItemProperty $registryHive -Name $connectionStringValueName -Value  $connectionStringValue| Out-Null
    Set-ItemProperty $registryHive -Name $providerValueName -Value $providerValue| Out-Null

    Unregister-CacheHost

    Register-CacheHost -Provider "SPDistributedCacheClusterProvider" -ConnectionString "Data Source=DBAlias;Initial Catalog=SPServer2013_Config;Integrated Security=True;Enlist=False" -Account "mitech\sqlsvc" -CachePort 22233 -ClusterPort 22234 -ArbitrationPort 22235 -ReplicationPort 22236 -HostName sharepoint-03

    start-cachehost -ComputerName server1 -CachePort 22233

    get-CacheHost

    Friday, December 20, 2019 1:51 PM
  • Hi,

    Please make sure you are on the latest patch of SharePoint 2013.

    According to this post, here are some more troubleshooting steps you can do to narrow down your issue. Check ULS logs for potential error message while you perform these actions:

    1. Run the PowerShell below on the affected Server:

    $SPfarm = Get-SPFarm
    $clusterMgr = [Microsoft.SharePoint.DistributedCaching.Utilities.SPDistributedCacheClusterInfoManager]::Local
    $cacheClusterInfo = $clusterMgr.GetSPDistributedCacheClusterInfo(‘SPDistributedCacheCluster’ + “_” + $SPFarm.Id.ToString())
    $cacheHostInfo = $cacheClusterInfo.CacheHostsInfoCollection[‘SERVERNAME_IN_CAPS’]
    $cacheHostInfo

    If the “CacheHostInfo is Null” error is thrown then $cacheHostInfo will not return anything

    2. To see what all entries are there run the command below:

    $cacheClusterInfo.CacheHostsInfoCollection | Select HostName, Name, DisplayName, CacheHostStatus

    If it doesn’t return the issued server, the entry from Config DB is missing.

    3. If there are multiple servers and the output is blank then run the command below:

    $CacheHostInfoCollection = new-object Microsoft.SharePoint.DistributedCaching.Utilities.SPDistributedCacheHostInfoCollection($cacheClusterInfo)
    $CacheHostInfoCollection | Select HostName, Name, DisplayName, CacheHostStatus

    4. If it does not return anything or the server that we expect is missing, run the SQL query against the configuration database and save the output to a CSV file. Make sure the output shows highlighted entries.

    select Name, id, parentid, cast (properties as xml) from objects where properties like ‘%SPDistributed%’

    5. Run the PowerShell command below and capture ULS logs individually:

    Remove-SPDistributedCacheServiceInstance
    Add-SPDistributedCacheServiceInstance

    6. If the cache host info entry is missing according to the SQL query output, delete Distributed service instance by:

    $DC = get-spserviceinstance -id <ID of DCintance highlighted in blue in above query output>
    $DC.delete()

    7. Run the SQL query again to confirm the entry of Distributed Service Instance is removed.

    8. Run the command below to add service instance back again.

    Add-SPDistributedCacheServiceInstance

    Here’s another article for your reference.

    Troubleshooting and Fixing Distributed Cache Service in SharePoint 2013.

    Please note: Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.

    Best regards,

    Chelsea Wu


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Monday, December 23, 2019 10:13 AM
  • I was unable to get any further with the help here.  I ended up loading a new server from scratch.  The new server works perfect.  

    That being said, since it took so long to resolve this, the data has become stale.  There are calendar entries and document libraries that have changed.  I would have to go through the process of migrating the database again,  Is there a way to just catch up the data with a simple backup and recovery without having to mess with databases?

    • Edited by trevoryour_cp Friday, January 3, 2020 4:44 PM submitted too soon
    Friday, January 3, 2020 4:38 PM
  • Hi,

    I’m afraid not. All backup and recovery plans in SharePoint Server are database-involved.

    Here’s your reference.

    Overview of backup and recovery in SharePoint Server.

    https://docs.microsoft.com/en-us/sharepoint/administration/backup-and-recovery-overview

    Best regards,

    Chelsea Wu


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    • Marked as answer by trevoryour_cp Monday, January 6, 2020 2:07 PM
    Monday, January 6, 2020 8:03 AM
  • Hi, 

    Thanks for marking my reply as the answer. I’m pleased to know that the information is helpful to you. 

    Here I will provide a summary of this post for your information.

    [Having trouble getting distrubuted cache working - Summary]

    Issue Symptom
    ====================
    Unable to start Distributed Cache service/App Fabric Caching Service

    Environment
    ====================
    SharePoint Server 2013

    Solution
    ====================
    Based on trevoryour_cp’s reply, the solution is:

    Rebuild the server and then migrate the database again to restore data.

    References
    ====================
    Manage the Distributed Cache service in SharePoint Server.

    https://docs.microsoft.com/en-us/sharepoint/administration/manage-the-distributed-cache-service

    App Fabric " DistributedCache " service not getting started and is in disabled state.

    https://social.technet.microsoft.com/Forums/office/en-US/13efc79b-ba6d-40d8-bb0d-5ebc4dc151d4/app-fabric-quot-distributedcache-quot-service-not-getting-started-and-is-in-disabled-state?forum=sharepointadmin

    Troubleshooting and Fixing Distributed Cache Service in SharePoint 2013.

    Overview of backup and recovery in SharePoint Server.

    https://docs.microsoft.com/en-us/sharepoint/administration/backup-and-recovery-overview

    Please note: Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.

    Best regards,

    Chelsea Wu


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Thursday, January 9, 2020 9:52 AM