SharePoint 2013 Distributed Cache errors

Caring for Distributed Cache is a task that should be on SharePoint Server Administrator list every month, but it’s a little forgotten. Usually we remember it only when something else fails, for example, incoming mail to the portal or search engine is not working. Although we do not need to shut down the server for the repair of defective caches, we can only repair the service and it can be corrected even in the morning, it is not recommended to ignore these errors. If distributed cache is too corrupted, it can be such a pity that we need to re-install the SharePoint server, which nobody wants.

It’s recommended to use powershell with Sharepoint management shell, but by no means re-start the AppFabric caching Service manually.

 

Configuration preview

 

use-cachecluster

get-AFCacheHostConfiguration

get-cachehost




Odstranjevanje/dodajanje host-a

 

It’s always useful to first stop the service and then remove it from a specific server. Start the commands on the server where we want to remove the distributed cache host or to repair its operation.

 

stop-SPDistributedCacheServiceInstance

remove-SPDistributedCacheServiceInstance

Add-SPDistributedCacheServiceInstance

 

FIX – cacheHostInfo is null

 

If the above commands do not work and throws an error  cacheHostInfo is null

$SPFarm = Get-SPFarm
$cacheClusterName = "SPDistributedCacheCluster_" + $SPFarm.Id.ToString()
$cacheClusterManager = [Microsoft.SharePoint.DistributedCaching.Utilities.SPDistributedCacheClusterInfoManager]::Local
$cacheClusterInfo = $cacheClusterManager.GetSPDistributedCacheClusterInfo($cacheClusterName);
$instanceName ="SPDistributedCacheService Name=AppFabricCachingService"
$serviceInstance = Get-SPServiceInstance | ? {($_.Service.Tostring()) -eq $instanceName -and ($_.Server.Name) -eq $env:computername}
$serviceInstance.Delete()
Add-SPDistributedCacheServiceInstance
$cacheClusterInfo.CacheHostsInfoCollection

These commands fix the Host info so that we can re-add to the Distributed Cache Service server using the command

Add-SPDistributedCacheServiceInstance

 

Fix – Error Starting Distributed Cache instance

 

First, we have to remove DC from server

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

Secondly, we add DC back on the server

$SPFarm = Get-SPFarm
$cacheClusterName = "SPDistributedCacheCluster_" + $SPFarm.Id.ToString()
$cacheClusterManager = [Microsoft.SharePoint.DistributedCaching.Utilities.SPDistributedCacheClusterInfoManager]::Local
$cacheClusterInfo = $cacheClusterManager.GetSPDistributedCacheClusterInfo($cacheClusterName);
$instanceName ="SPDistributedCacheService Name=AppFabricCachingService"
$serviceInstance = Get-SPServiceInstance | ? {($_.Service.Tostring()) -eq $instanceName -and ($_.Server.Name) -eq $env:computername}
$serviceInstance.Delete()
Add-SPDistributedCacheServiceInstance

Fix – Invalid provider and connection string read

 

Sometimes registry entries are blank for Provider and string. So we add them manually to register
HKEY_LOCAL_MACHINE >> SOFTWARE >> MICROSOFT >> AppFabric >> V1.1 >> CONFIGURATION

Connection String:
Data Source=spsql;Initial Catalog=SPFarm_SharePoint_Config;Integrated Security=True;Enlist=False
 (spsq – name of your’s SQL server with SharePoint databases)

Provider:
SPDistributedCacheClusterProvider

Admin Configured in Service configured have value 0

 

Than we use this command again to check configuration

use-cachecluster

and of course

get-cachehost

 

Remember: you should never manually launch the AppFabric caching Service on the server, always through the powershell commands!

Distributed cache is important for the performance of some other services on SharePoint – the most value service is certainly a search engine and search is not working without DC.

Another tip: You save the AppFabric configuration when its working well so that a functioning configuration can easily be imported when distributec cache have errors.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

SharePoint 2013 Distributed Cache okvare

Skrb za Distributed Cache je opravilo, ki bi moralo biti na seznamu skrbnika strežnika SharePoint vsak mesec, a se kar malo pozablja na njega. Spomnimo se šele takrat, ko kakšna druga stvar zataji npr. prihajajoča pošta v portal ali pa iskalnik. Čeprav za popravljanje okvarjenih cache-ov ne potrebujemo zaustavljati strežnika, le storitev in ga lahko popravljamo celo dopoldan, ni priporočljivo, da ignoriramo te napake. Če se distributed cache preveč pokvari, je lahko takšna škoda, da moramo SharePoint server postaviti na novo, kar pa si nihče ne želi.

Priporočljivo je uporabljati powershell s Sharepoint management shell, nikakor pa ne ročno reštartati storitev AppFabric caching Service.

 

Pregled konfiguracije

 

use-cachecluster

get-AFCacheHostConfiguration

get-cachehost




Odstranjevanje/dodajanje host-a

 

Vedno je koristno, da se najprej zaustavi service in nato odstrani iz določenega serverja. Ukazi se zaženejo na strežniku, kjer hočemo odstraniti distributed cache host-a oz. popraviti njegovo delovanje.

stop-SPDistributedCacheServiceInstance

remove-SPDistributedCacheServiceInstance

Add-SPDistributedCacheServiceInstance

 

FIX – cacheHostInfo is null

 

Če zgoraj omenjeni ukazi ne delujejo in vrže napako cacheHostInfo is null

$SPFarm = Get-SPFarm
$cacheClusterName = "SPDistributedCacheCluster_" + $SPFarm.Id.ToString()
$cacheClusterManager = [Microsoft.SharePoint.DistributedCaching.Utilities.SPDistributedCacheClusterInfoManager]::Local
$cacheClusterInfo = $cacheClusterManager.GetSPDistributedCacheClusterInfo($cacheClusterName);
$instanceName ="SPDistributedCacheService Name=AppFabricCachingService"
$serviceInstance = Get-SPServiceInstance | ? {($_.Service.Tostring()) -eq $instanceName -and ($_.Server.Name) -eq $env:computername}
$serviceInstance.Delete()
Add-SPDistributedCacheServiceInstance
$cacheClusterInfo.CacheHostsInfoCollection

To popravi Host info, tako da lahko ponovno dodamo serverju Distributed Cache Service z uporabo ukaza

Add-SPDistributedCacheServiceInstance

Fix – Error Starting Distributed Cache instance

 

Najprej je potrebno odstraniti DC iz serverja

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

Nato ponovno dodamo DC na server

$SPFarm = Get-SPFarm
$cacheClusterName = "SPDistributedCacheCluster_" + $SPFarm.Id.ToString()
$cacheClusterManager = [Microsoft.SharePoint.DistributedCaching.Utilities.SPDistributedCacheClusterInfoManager]::Local
$cacheClusterInfo = $cacheClusterManager.GetSPDistributedCacheClusterInfo($cacheClusterName);
$instanceName ="SPDistributedCacheService Name=AppFabricCachingService"
$serviceInstance = Get-SPServiceInstance | ? {($_.Service.Tostring()) -eq $instanceName -and ($_.Server.Name) -eq $env:computername}
$serviceInstance.Delete()
Add-SPDistributedCacheServiceInstance

Fix – Invalid provider and connection string read

 

Včasih se izgubijo nastavitve v registru za Provider in String. Takrat je potrebno ročno dodati nastavitve v register.
HKEY_LOCAL_MACHINE >> SOFTWARE >> MICROSOFT >> AppFabric >> V1.1 >> CONFIGURATION

Connection String:
Data Source=spsql;Initial Catalog=SPFarm_SharePoint_Config;Integrated Security=True;Enlist=False
 (spsq – ime vašega sql serverja, kjer se nahajajo SharePoint baze)

Provider:
SPDistributedCacheClusterProvider

Admin Configured in Service configured imata vrednost 0

Nato lahko znova uporabimo ukaz

use-cachecluster

in nato

get-cachehost

 

Potrebno pa si je zapomniti: nikoli naj se ne ročno začene storitev na strežniku AppFabric caching Service, vedno preko powershell ukazov!

Distributed cache je pomemben za delovanje nekaterih drugih storitev na SharePoint-u – najbolj pomembna storitev je zagotovo je iskalnik.

Å e en nasvet: shrani si konfiguracijo AppFabric, dokler dela kot je treba, da se lahko pri okvarjeni konfiguracijo enostavno uvozi delujoča konfiguracija.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.