Edit the server name in the script below.
Prob savest if you copy the code from the link provided below.
## Settings you may want to change for your scenario ##
$startTime = Get-Date
$currentTime = $startTime
$elapsedTime = $currentTime - $startTime
$timeOut = 900
try
{
Use-CacheCluster
Get-AFCacheClusterHealth
Write-Host "Shutting down distributed cache host."
$hostInfo = Stop-CacheHost -Graceful -CachePort 22233 -HostName sp2013App.contoso.com
while($elapsedTime.TotalSeconds -le $timeOut-and $hostInfo.Status -ne 'Down')
{
Write-Host "Host Status : [$($hostInfo.Status)]"
Start-Sleep(5)
$currentTime = Get-Date
$elapsedTime = $currentTime - $startTime
#Get-AFCacheClusterHealth
$hostInfo = Get-CacheHost -HostName SP2013app.contoso.com -CachePort 22233
}
Write-Host "Stopping distributed cache host was successful. Updating Service status in SharePoint."
Stop-SPDistributedCacheServiceInstance
Write-Host "To start service, please use Central Administration site."
}
catch [System.Exception]
{
Write-Host "Unable to stop cache host within 15 minutes."
}
https://technet.microsoft.com/en-us/library/jj219613.aspx?f=255&MSPPError=-2147217396#graceful
Steps when upgrading AppFabric:
- Do one server at a time.
- Run Script above on the server before you install the CU. At the moment, CU7 is the latest.
- I wait 15min, not sure how long it takes to transfer everything to the other server.
- Run the CU.
- Edit DistributedCacheserver.exe for Garbage collection feature.
- Start AppFabric on Central Admin
It is best practice to do it on all the servers running SharePoint if you decide to move app fabric around in the future.