Introduction
This posting walks through the steps necessary for removing a distributed cache host from a SharePoint farm server that has been removed, terminated, or is otherwise unrecoverable.
Procedure
This posting walks through the steps necessary for removing a distributed cache host from a SharePoint farm server that has been removed, terminated, or is otherwise unrecoverable.
Procedure
- Preparation
- Identify the name of the unrecoverable cache host (eg, SERVER1).
- Identify the connection string used by the distributed cache service to connect to the farm database:
- On any farm server hosting SharePoint, launch a command prompt with elevated privileges.
- Execute regedit.
- Navigate to: HKLM\SOFTWARE\Microsoft\AppFabric\V1.0\Configuration.
- Open a new NotePad instance.
- Copy the contents of the ConnectionString parameter to NotePad.
- Remove the last parameter of this string, or ";Enlist=False" including the ";".
- Save this text; you'll need it later.
- Connect
- Login to a SharePoint farm server as the SharePoint Setup User Administrator account.
- Launch the SharePoint 2013 Management Shell with elevated privileges.
- Check cache status
- Execute Use-CacheCluster and then Get-CacheHost to check current distributed cache status.
- Unregister the cache host:
- Execute Unregister-CacheHost -HostName "YourHostName"
- At the prompt for ProviderType, enter SPDistributedCacheClusterProvider.
- At the prompt for ConnectionString, enter the string you saved back in Preparation step 1.7. Unregistration takes only a few seconds.
- Check cache status
- Execute Get-CacheHost to check current distributed cache status. The target cache host should no longer be listed.
- Execute Stop-CacheCluster followed by Start-CacheCluster: these commands should complete without any errors and without the target cache host being listed.
- Manage the Distributed Cache service in SharePoint Server 2013
- Delete Cache Host, SharePoint 2013
- AppFabric Caching PowerShell Cmdlets: this is the complete reference for all PowerShell commands used for AppFabric.
- Sample: RemoveCacheHost Script (Windows Server Appfabric Caching)
- Windows Server AppFabric Caching Deployment and Management Guide: this was written for SharePoint 2010, but is still an outstanding reference. This link takes you to the downloadable document.
- AppFabric 1.1 Caching Deployment and Management Guide
- Stop-CacheCluster: There's no need to bring down the cache cluster before unregistering the target cache host. if you do first bring it down, and then try to execute the Unregister-CacheHost command, you may experience an error:
Unregister-CacheHost : ErrorCode<ClusterNotInitialized>: SubStatus<ES0001>:No cluster configuration is present in target.
. - Unregister-CacheHost: Don't use the Unregister-CacheHost format presented in the Windows Server AppFabric Caching Deployment and Management Guide, page 13. This won't work. Instead, use the steps I've provided in the Unregister the cache host section, above.
- Servers in Farm: you may need to remove the target server from the farm.
- ConnectionString: you can also use PowerShell to get this value. To do so: open a SharePoint management shell with elevated privileges. Then execute the following:
Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\AppFabric\V1.0\Configuration"
Note that you are using "HKLM" and not "HKEY_LOCAL_MACHINE".
4 comments:
when Get-Cachehost I get 3 Hostnames - one I would like to remove... following the guide you provided - but then I see this
Unregister-CacheHost : ErrorCode:SubStatus:No such host is known
At line:1 char:1
+ Unregister-CacheHost -HostName "Servertoremove:port"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Unregister-AFCacheHost], DataCacheException
+ FullyQualifiedErrorId : UnspecifiedErrorCode,Microsoft.ApplicationServer.Caching.Configuration.Commands.UnregisterAFCacheHostC
ommand
can you plz advise?
Don't use port number and don't quotation marks for UnRegister-CacheHost
Hi Al, I was hoping you could help me with what I have going on. I have a server that is dead and gone but showing up in my Get-CacheHost as an Unknown. I've tried to unregister it but have had no luck. Any advice? thanks in advance :
PS C:\> Get-CacheHost
HostName : CachePort Service Name Service Status Version Info
-------------------- ------------ -------------- ------------
GOIO-SPSQL01.go.local:22233 AppFabricCachingService UP 3 [3,3][1,3]
GOIO-SPWEB01.go.local:22233 AppFabricCachingService UNKNOWN 0 [0,0][0,0]
GOIO-SPWEB02.go.local:22233 AppFabricCachingService DOWN 3 [3,3][1,3]
PS C:\> Unregister-CacheHost -HostName goio-spweb01.go.local
cmdlet Unregister-AFCacheHost at command pipeline position 1
Supply values for the following parameters:
ProviderType: SPDistributedCacheClusterProvider
ConnectionString: Data Source=goio-spsql01.go.local;Initial Catalog=SharePoint_C
onfig;Integrated Security=True
Unregister-CacheHost : ErrorCode:SubStatus:No
such host is known
At line:1 char:1
+ Unregister-CacheHost -HostName goio-spweb01.go.local
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Unregister-AFCacheHost], Data
CacheException
+ FullyQualifiedErrorId : UnspecifiedErrorCode,Microsoft.ApplicationServer
.Caching.Configuration.Commands.UnregisterAFCacheHostCommand
PS C:\>
Jeff - first off, if I read things correctly from what you pasted above, you're running AppFabric on one of your SQL Server backends. I would recommend removing it from this. The reason being that AppFabric can consume lots of memory and this will directly impact SQL Server performance. Second, my experience has been that merely unregistering AppFabric from a server hasn't been enough: I've also had to remove it. Please see This Distributed Cache host may cause cache reliability problems (SharePoint 2013). Then review SharePoint 2013: This Distributed Cache host may cause cache reliability problems, which provides steps for deleting and removing the service.
Post a Comment