So for the past few weeks, I have been living and breathing Sharepoint. I had heard how tortuous the process can be, however I had thought when I was first setting it up that it was just older versions that had been bad and maybe 2013 version was better. Well I was mistaken.

We needed to implement the enterprise version because we needed to use BI with powerpivot, powerview and any other power tools that come with the enterprise version. One of the most time consuming pieces is getting PowerPivot working with Analysis Services and Reporting on an Active/Active Cluster. It is not that it was necessarily hard more than had I known more about Sharepoint before setting it up, It probably would have saved me a lot of headache. All this is topics for later though.

The point of this post was to shed a little light on a distributed Cache issue I was getting for some time. Today I decided to fix it. I first was receiving an error on Sharepoint saying that Appfabric was being disabled due to inconsistencies between cache on other hosts in the cluster. After searching many forums on the core issue that causes this I found a lot of posts telling me just how to fix it. When trying many suggestions out how to fix the issue I had learned some things that I thought I would pass along to all of you.

First of all I will preface this with the fact that the AppFabric  cluster had been running on this host without issue when all of a sudden it became corrupted and shut down. Here are my lessons. Try NOT to touch the Appfabric service at all on the server. If it is disabled the only thing I suggest is change the service to automatic start up again and shut down the service if you receive an error and need to. I had tried to start and stop the service many times while trying different things and I believe that many of the errors i ran into were due to the fact that the AppFabric service was off while i was trying to tie distributed cache back to it. So here are the steps to correct the problem.

  • Look at “Distributed Cache” for the host in question on the Sharepoint CA.
  • If it is Stopped or failed, open Sharepoint PowerShell on the host with the issue and run Remove-SPDistributedCacheServiceIntance.
  • If you receive the following error proceed

pic1

  • Run the following script. Replace the blacked out area with the name of your server

pic2

  • Run Remove-CacheHost If you receive the following error then stop the AppFabric service on the host.

pic3

  • Once you have stopped the AppFabric service you can re-run “Remove-CacheHost”. If it is successful you will not receive a message. You will just get a PS prompt returned.
  • Now run “Add-CacheHost”. This should prompt you for some parameters to enter. The values you enter need to be correct. I found that if you enter an incorrect provider into here, that it will cause the service to fail and you will have a heck of a time trying to figure out why. My suggestion would be to go to another host in the cluster and look up the values for HKLM\SOFTWARE\MICROSOFT\APPFABRIC\V1.0\CONFIGURATION\PROVIDER and Connection String. Many forums stated that the Provider to use was SPDistributedCacheProvider however this caused a problem for me because I found that my cluster was using SPDistributedCacheClusterProvider. Now once these parametes are entered. Your AppFabric should know now how to connect to the database but there is still more to do.
  • Next you need to run Remove-SPDistributedCacheServiceInstance again. This should remove distributed cache on the host for Sharepoint. If you receive the following error, check Sharepoint CA If the Distributed Cache service is still showing in “Services On Server” then the service was not fully removed.

pic4

  • Run the following commands to fully remove the service from Sharepoint. You may receive the error again. That is fine. Make sure you run the last command.

pic5

  • You should receive a Powershell prompt after that. If so, run Remove-SPDistributedCacheServiceInstance again. This time you should get the Powershell prompt without an error.
  • Now run Get-CacheHost you should see your host that is having issues in a down state because Appfabric cannot talk to distributed cache on the host because you just removed it.

pic6

  • Now we will add the Distributed Cache back to the host by running Add-DistributedCacheServiceInstance. If successful you should receive the powershell prompt without an error.
  • Run the following command afterwards   Register-CacheHost –Provider “SPDistributedCacheClusterProvider” –ConnectionString “Data Source={DatabaseName};Initial Catalog=SharePoint_Config;Integrated Security=True;Enlist=False” -Account “{service account used with AppFabric}” -CachePort 22233 -ClusterPort 22234 -ArbitrationPort 22235 -ReplicationPort 22236 –HostName {name of server}
  • That should ensure that the servers Distributed Cache is registered to AppFabric cluster. If registered already you may receive an error stating the port is already in use.
  • If all works out you can now run Get-Cache Host and you should see all your servers with a status of up.

pic7

I found that no one forum in particular had the right answer for me, however with trial and error and using a combination of suggestions on multiple forums, I was able to get it fixed within a few hours. Let me know if I can be of any help and as always come visit us at http://www.mjddesignconcepts.com and get discounts on IT services we provide.

Advertisements