Day Tips:分布式缓存的删除和重建

遇到cacheHostInfo is null 错误时,必须将这台服务器上的实例删除重新创建

   

$instanceName ="SPDistributedCacheService Name=AppFabricCachingService";

$serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername};

$serviceInstance.Delete()

如果删除重建之后仍然不起作用请尝试以下代码:

Unregister-AFCacheHost

执行完毕之后

Remove-CacheHost(如果remove的时候还是错误请先Add-CacheHost

在确定Remove-CacheHost之后执行

Add-SPDistributedCacheServiceInstance

如果在Services on Server那没有发现服务Distributed Cache ,执行以下代码,也就是添加新的服务实例的代码。

Add-SPDistributedCacheServiceInstance

在全部只执行完毕之后要确定Host是否Up执行代码get-CacheHost

   

   

注意:以上代码执行需要在指定的需要开启服务的服务器上执行。

http://technet.microsoft.com/en-us/library/jj219613.aspx

  

原文地址:https://www.cnblogs.com/Believeme/p/3423565.html