Clear configuration cache SharePoint

[siteorigin_widget class=”WordAds_Sidebar_Widget”][/siteorigin_widget]
[siteorigin_widget class=”WordAds_Sidebar_Widget”][/siteorigin_widget]
If you experience issues with timer jobs failing to complete and receiving errors while trying to run psconfig, Clear configuration cache SharePoint on the farm is a possible method for resolving the issue.

The config cache is where we cache configuration information (stored in the config database) on each server in the farm.

Caching the data on each server prevents us from having to make SQL calls to pull this information from the configuration database.Sometime this data can become corrupted and needs to be cleared out and rebuilt.

If you only see a single server having issues,only clear the config cache on that server,you do not need to clear the cache on the entire farm. To do a single server, follow the steps below on just the problem server.

To clear the config cache on the farm, follow these steps:

1. Stop the OWSTIMER service on ALL of the servers in the farm.

stop-timer-service

2. On the Index server, navigate to:
\ProgramData\Microsoft\SharePoint\Config\GUID and delete all the XML files from the directory.

3. Delete all the XML file in the directory. NOTE: ONLY THE XML FILES, NOT THE .INI FILE.

Clear configuration cache SharePoint

4. Open the cache.ini with Notepad and reset the number to 1. Save and close the file.

change-id

5. Start the OWSTIMER service on the Index server and wait for XML files to begin to reappear in the directory.

6. After you see XML files appearing on the Index server, repeat steps 2, 3 & 4 on each query server, waiting for XML files to appear before moving to subsequent servers.

timer3

7. After all of the query servers have all been cleared and new .xml files have been generated, proceed to the WFE and Application servers in the farm, following steps 2, 3, 4 and 5 for each remaining server.

Repairing distributed cache with PowerShell

  • Recently we had issues with our distributed cache system that was set up on are farm quite some time ago when I built it with SPAuto-Installer.  This could have been from rolling out cumulative updates or what have you.  There is very little documentation on the web for this.

*  In our case we had 4 servers (2 web front-ends and 2 application servers)  all with the distributed cache enabled.  Only one server was running the distributed cache.

*  The correct topology for distributed cache is for it to exist on the web front-ends.  So we made some changes to the farm.

Clean up all 4 Servers using the following commands:

#Stopping the service on local host

Stop-SPDistributedCacheServiceInstance -Graceful

#Removing the service from SharePoint on local host.

Remove-SPDistributedCacheServiceInstance

#Cleanup left over pieces from SharePoint

$instanceName =”SPDistributedCacheService Name=AppFabricCachingService”

$serviceInstance = Get-SPServiceInstance | ? {($.service.tostring()) -eq $instanceName -and ($.server.name) -eq $env:computername}

$serviceInstance.delete()

Then we added the cache host back to WEB01:

#Re-add the server back to the cluster

Add-SPDistributedCacheServiceInstance

We then checked the SPDistributedCacheClientSettings and found that “MaxConnectionsToServer” was set to 16 for all containers.

$DLTC = Get-SPDistributedCacheClientSetting -ContainerType DistributedLogonTokenCache

$DLTC

We used the following script to change  “MaxConnectionsToServer” back to 1 and increase the timeout for each container.

Add-PSSnapin Microsoft.Sharepoint.Powershell

#DistributedLogonTokenCache

$DLTC = Get-SPDistributedCacheClientSetting -ContainerType DistributedLogonTokenCache

$DLTC.MaxConnectionsToServer = 1

$DLTC.requestTimeout = “3000”

$DLTC.channelOpenTimeOut = “3000”

Set-SPDistributedCacheClientSetting -ContainerType DistributedLogonTokenCache -DistributedCacheClientSettings $DLTC

#DistributedViewStateCache

$DVSC = Get-SPDistributedCacheClientSetting -ContainerType DistributedViewStateCache

$DVSC.MaxConnectionsToServer = 1

$DVSC.requestTimeout = “3000”

$DLTC.channelOpenTimeOut = “3000”

Set-SPDistributedCacheClientSetting -ContainerType DistributedViewStateCache $DVSC

#DistributedAccessCache

$DAC = Get-SPDistributedCacheClientSetting -ContainerType DistributedAccessCache

$DAC.MaxConnectionsToServer = 1

$DAC.requestTimeout = “3000”

$DAC.channelOpenTimeOut = “3000”

Set-SPDistributedCacheClientSetting -ContainerType DistributedAccessCache $DAC

#DistributedAccessCache

$DAF = Get-SPDistributedCacheClientSetting -ContainerType DistributedAccessCache

$DAF.MaxConnectionsToServer = 1

$DAF.requestTimeout = “3000”

$DAF.channelOpenTimeOut = “3000”

Set-SPDistributedCacheClientSetting -ContainerType DistributedActivityFeedCache $DAF

#DistributedActivityFeedLMTCache

$DAFC = Get-SPDistributedCacheClientSetting -ContainerType DistributedActivityFeedLMTCache

$DAFC.MaxConnectionsToServer = 1

$DAFC.requestTimeout = “3000”

$DAFC.channelOpenTimeOut = “3000”

Set-SPDistributedCacheClientSetting -ContainerType DistributedActivityFeedLMTCache $DAFC

#DistributedBouncerCache

$DBC = Get-SPDistributedCacheClientSetting -ContainerType DistributedBouncerCache

$DBC.MaxConnectionsToServer = 1

$DBC.requestTimeout = “3000”

$DBC.channelOpenTimeOut = “3000”

Set-SPDistributedCacheClientSetting -ContainerType DistributedBouncerCache $DBC

#DistributedDefaultCache

$DDC = Get-SPDistributedCacheClientSetting -ContainerType DistributedDefaultCache

$DDC.MaxConnectionsToServer = 1

$DDC.requestTimeout = “3000”

$DDC.channelOpenTimeOut = “3000”

Set-SPDistributedCacheClientSetting -ContainerType DistributedDefaultCache $DDC

#DistributedSearchCache

$DSC = Get-SPDistributedCacheClientSetting -ContainerType DistributedSearchCache

$DSC.MaxConnectionsToServer = 1

$DSC.requestTimeout = “3000”

$DSC.channelOpenTimeOut = “3000”

Set-SPDistributedCacheClientSetting -ContainerType DistributedSearchCache $DSC

#DistributedSecurityTrimmingCache

$DTC = Get-SPDistributedCacheClientSetting -ContainerType DistributedSecurityTrimmingCache

$DTC.MaxConnectionsToServer = 1

$DTC.requestTimeout = “3000”

$DTC.channelOpenTimeOut = “3000”

Set-SPDistributedCacheClientSetting -ContainerType DistributedSecurityTrimmingCache $DTC

#DistributedServerToAppServerAccessTokenCache

$DSTAC = Get-SPDistributedCacheClientSetting -ContainerType DistributedServerToAppServerAccessTokenCache

$DSTAC.MaxConnectionsToServer = 1

$DSTAC.requestTimeout = “3000”

$DSTAC.channelOpenTimeOut = “3000”

Set-SPDistributedCacheClientSetting -ContainerType DistributedServerToAppServerAccessTokenCache $DSTAC

  • We then stopped and restarted Distributed Cache from Central Admin on WEB01
  • We then attempted to start “Distributed Cache” on WEB02 and received error “failed to connect to hosts in the cluster”
  • Performing a TRACERT from WEB01 to WEB02, we can see a device is in the middle (10.21.1.5).
  • Installed Telnet

Import-Module servermanager

Add-WindowsFeature telnet-client

  • Telnet from WEB01 to WEB02 on port 22233 and the connection was established.
  • We then stopped, cleaned and added WEB02 back to the cache farm
  • #Stopping the service on local host

    Stop-SPDistributedCacheServiceInstance -Graceful

    #Removing the service from SharePoint on local host.

    Remove-SPDistributedCacheServiceInstance

    #Cleanup left over pieces from SharePoint

    $instanceName =”SPDistributedCacheService Name=AppFabricCachingService”

    $serviceInstance = Get-SPServiceInstance | ? {($.service.tostring()) -eq $instanceName -and ($.server.name) -eq $env:computername}

    $serviceInstance.delete()

    Then we added the cache host back to WEB02:

    #Re-add the server back to the cluster

    Add-SPDistributedCacheServiceInstance

    This time it started!

    • Now we have WEB01 and WEB02 servicing distributed Cache
  • We checked the ULS Logs with ULSViewer and found all successful events for Distributed Cache.
  • Status

    =======

    Distributed cache is now healthy and in a working state on both WFE Servers.