Wednesday 9 November 2016

Distributed Cache on Error Starting in one of the SharePoint 2013 server in a Farm.



Recently I want to setup a Medium SharePoint Server farm with 2+2 concept. 2 SharePoint web Front end Servers and 2 SharePoint Application Servers.

The second app server was included to the SharePoint farm after a month. During the time as per the requirement we stopped the Distributed cache on WFE's and started the same in APP#01.

When tried to starting the distributed cache on APP#02 it shows error starting.

Then did lot of option from Google Suggestion but no luck, so thought back my IIS admin role and copied "DistributedCacheService.exe.config" from working server (APP#01).

The config file will be available on "C:\Program Files\AppFabric 1.1 for Windows Server".

After copied I tried to start the service using powershell with the cmdlet of Start-SPServiceInstance.

Again it failed after a day but with below error.


Error executing service instance (un)provisioning job.  Service instance: "Distributed Cache" (id "b6c10332-478a-483a-9b1a-a949040de1d9) "cacheHostInfo is null""

with the error message of CacheHostInfo is null and decided to fix the Cluster Configuration of Distributed cache and got a ps script


Solution:


  • Copy the below and Save it with .ps1 extenstion.
$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))
{
    #here's the key. we can't provision, unprovision, start, or stop a Cache Service because we still have a Cache Service that have no server attached
    $serviceInstance.Delete()
    Add-SPDistributedCacheServiceInstance
    $cacheClusterInfo.CacheHostsInfoCollection
--------------------------------------------------------------------------------------------------------------------------

  • Execute the .ps1 from the server where the Distributed Cache is working fine.
  • Login to the server where distributed cache is having a problem to start
  • Find and get the service Instance ID of distributed cache which has problem.
  • To find the below command will help you to take it
Get-SPServiceInstance | ? {($_.service.tostring()) -eq “SPDistributedCacheService Name=AppFabricCachingService”} | select Server, Status


  • Copy the service instance ID which has problem and past it in the below command. which will delete the service instance. 

$service = get-spserviceinstance b6c10332-478a-483a-9b1a-a949040de1d9 
$service.Delete() 

  • If you execute the below command it will display remaining server except the one which has the problem.
Get-SPServiceInstance | ? {($_.service.tostring()) -eq “SPDistributedCacheService Name=AppFabricCachingService”} | select Server, Status

  • Now execute the  Add-SPDistributedCacheServiceInstance cmdlet in ps window.
If you are having a luck and completing the task without any escalation the above command will be the solution for the issue and refer the central admin. Distributed cache is started on the APP#02.

You can leave reading the post from here and have a JIGARTHANDA (A desert of Madurai, TN, INDIA).

Now if you are reading here then you are like me, being an active person, hard worker and still not getting the place what you want or expecting ;-)

You might again getting the cacheHostInfo is null error in event viewer. So simple Go to services.msc and start Remote Registry services.

Now again execute the script and login back to the App#02 server which has problem.

Execute the cmdlet for deleting the instance and run the  Add-SPDistributedCacheServiceInstance.

Issues is  resolved for me. As usual I learnt new thing and created a post here.

Your suggestions are welcome.



1 comment:

Rescan Disk Option Greyed Out | New Disks Not visible on Disk management | Update-HostStorageCache

  Recently I have added several LUN from NetApp Storage to Hyper-V servers. But in the disk management I couldn't see those new LUN. Exi...