We had issue with Distributed Cache in SharePoint 2013
In ULS and event we were getting lots of errors related to Distributed cache.
Event ID: 6398
Task Category: Timer
Level: Critical
Keywords:
User: xxxxxxxxxxx
Computer: xxxxxxxxx
Description:
The Execute method of job definition Microsoft.Office.Server.UserProfiles.LMTRepopulationJob (ID ba320718-0e80-4295-a3f8-a4badea59f0d) threw an exception. More information is included below.
Unexpected exception in FeedCacheService.IsRepopulationNeeded: Cache cluster is down, restart the cache cluster and Retry.
We ran following commands to fix the cache issue
Remove-SPDistributedCacheServiceInstance
$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}
if([System.String]::IsNullOrEmpty($cacheClusterInfo.CacheHostsInfoCollection))
{
$serviceInstance.Delete()
}
After this we ran following command
$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}
if([System.String]::IsNullOrEmpty($cacheClusterInfo.CacheHostsInfoCollection))
{
Add-SPDistributedCacheServiceInstance
$cacheClusterInfo.CacheHostsInfoCollection
}
We ran Get-CacheHost and it shows the service is up
Made sure service is showing as started on the server