Patching AppFabric (Distributed Cache) for SharePoint 2013
Patching App Fabric on a SharePoint 2013 Farm
Introduction
The Distributed Cache is a new feature in SharePoint 2013. It provides in-memory caching services to several features including Newsfeeds, Authentication, OneNote client access, Security Trimming, and Page load performance. It runs off a Microsoft technology called AppFabric, which means that any patching that AppFabric needs, your SharePoint 2013 environments will need as well.
Patching AppFabric is a little different from the normal SharePoint patches you may apply. Extra steps need to be taken to keep your farm in working order. In the words of Microsoft: “The Distributed Cache service can end up in a nonfunctioning or unrecoverable state if you do not follow the procedures that are listed in this article. In extreme scenarios, you might have to rebuild the server farm.” …Yikes!
All Distributed Cache configurations will be handled in PowerShell as the setup account. Do not attempt to administer the Distributed Cache through Central Administration. The only related thing you can use Central Administration for is to see what servers the Distributed Cache service is running on. Also, do not attempt to administer the AppFabric service through Windows Services.
Patching
In most cases, the Distributed Cache service is not running on every server in the farm, however the AppFabric bits are installed on every server in the farm. For this reason, AppFabric patches will need to be installed on every server in the farm, not just the servers running Distributed Cache.
- Patch non-Distributed Cache servers -To find out what servers in your farm are running the Distributed Cache service, you can log into Central Administration, Manage Services on Server, click the dropdown to cycle through each server in the farm, and see if it has the Distributed Cache service running. Note: unlike other services, you will not see Distributed Cache with a status of Stopped if that server is not running it. You simply won’t see a line entry for Distributed Cache at all. Additionally, if you know one of the servers running Distributed Cache, you can run the following PowerShell from that server as the setup account. These commands will not work from a server not running the Distributed Cache service.
Once you know what servers in your farm are not running the Distributed Cache service, you may match them as normal.
- Patch Distributed Cache servers – From the step above, we already found what servers in the farm are running the Distributed Cache service. To patch these servers, you must first stop the service one at a time. You can’t simply stop it like you would any other service as this can result in data loss.
- You must use the script below to gracefully stop the service, transferring all data that lived in that cache to another server in the cluster. Microsoft documents that this script may take up to 15 minutes to run. I have set the timeout to 30 minutes to be safe.
[caption id="attachment_266" align="aligncenter" width="961"] This is a slightly modified version from this TechNet article: https://technet.microsoft.com/en-us/library/jj219613(v=office.15).aspx\[/caption\]
-
- Once the script is complete, you may patch that server.
- Once the server is patched, you can start the Distributed Cache service again by running:
-
- Repeat the above steps on every other server in the farm that is running the Distributed Cache service.
Making Sure Stuff Isn’t Jacked Up
Since this is an AppFabric patch, and not a SharePoint patch, we do not need to run PSConfig after patching, but we do want to make sure Distributed Cache is working correctly before we celebrate.
- Log on to one of the servers in the farm that should have the Distributed Cache service running on it and run the following command again:
- This should match what it looked like the first time you ran it before patching started. Verify the Service Status says Up for each entry.
- Click on Central Administration for the farm. View the SharePoint Health Analyzer issues that appear on the top of the page. Make sure there are no entries referring to Distributed Cache.
- Run Get-CacheClusterHealth. If anything is listed under Unallocated, make sure they go away after 15 minutes or so.