Search This Blog

Thursday, 12 May 2016

Stop-SPDistributedCacheInstace -Graceful is not graceful!!

Came across this when i posted on a forum regarding appFabric and Nauplius pointed out to me that the command that everyone is using is not truly graceful...

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




Write-Host "Shutting down distributed cache host."
$hostInfo = Stop-CacheHost -Graceful -CachePort 22233 -HostName

while($elapsedTime.TotalSeconds -le $timeOut-and $hostInfo.Status -ne 'Down')
Write-Host "Host Status : [$($hostInfo.Status)]"
$currentTime = Get-Date
$elapsedTime = $currentTime - $startTime
$hostInfo = Get-CacheHost -HostName -CachePort 22233

Write-Host "Stopping distributed cache host was successful. Updating Service status in SharePoint."
Write-Host "To start service, please use Central Administration site."
catch [System.Exception]
Write-Host "Unable to stop cache host within 15 minutes."

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.

1 comment:

  1. BlueHost is the best hosting provider for any hosting plans you require.