AppFabric 无法创建 DataCache(LMTRepopulationJob 失败)

AppFabric unable to create a DataCache (LMTRepopulationJob FAILS)

首先,我正在学习 Sharepoint 2013 并且我一直在学习一些教程,到目前为止我只是设置了一个服务器场并且一切似乎都正常工作,除了正在登录到事件查看器中的这项服务每 5 分钟:

The Execute method of job definition Microsoft.Office.Server.UserProfiles.LMTRepopulationJob (ID 1e573155-b7f6-441b-919b-53b2f05770f7) threw an exception. More information is included below.

Unexpected exception in FeedCacheService.BulkLMTUpdate: Unable to create a DataCache. SPDistributedCache is probably down..

我发现这是一个配置为每 5 分钟执行一次的作业

但是关于SPDistributedCache可能宕机的假设,我已经验证过了,是运行

如您所见,它实际上是 运行,我还通过 SP powershell(get-cachehostget-cacheclusterhealth)检查了主机缓存,但一切似乎都很好

然而,当我执行命令 get-cache 时,我只得到默认值,对于我所读到的内容,应该列出其他缓存类型,如:

DistributedAccessCache_XXXXXXXXXXXXXXXXXXXXXXXXX DistributedBouncerCache_XXXXXXXXXXXXXXXXXXXXXXXX DistributedSearchCache_XXXXXXXXXXXXXXXXXXXXXXXXX DistributedServerToAppServerAccessTokenCache_XXXXXXX DistributedViewStateCache_XXXXXXXXXXXXXXXXXXXXXXX

在我认为可能应该包括 DataCache 的其他内容中

到目前为止,我已经尝试了一些解决方法但没有成功

Restart-Service AppFabricCachingService
Remove-SPDistributedCacheServiceInstance
Add-SPDistributedCacheServiceInstance
Restart-CacheCluster

甚至这个脚本似乎在很多情况下都能修复 AppFabric 缓存服务

$SPFarm = Get-SPFarm
$cacheClusterName = "SPDistributedCacheCluster_" + $SPFarm.Id.ToString()
$cacheClusterManager = [Microsoft.SharePoint.DistributedCaching.Utilities.SPDistributedCacheClusterInfoManager]::Local
$cacheClusterInfo = $cacheClusterManager.GetSPDistributedCacheClusterInfo($cacheClusterName);
$instanceName ="SPDistributedCacheService Name=AppFabricCachingService"
$serviceInstance = Get-SPServiceInstance | ? {($_.Service.Tostring()) -eq $instanceName -and ($_.Server.Name) -eq $env:computername}
$serviceInstance.Delete()
Add-SPDistributedCacheServiceInstance
$cacheClusterInfo.CacheHostsInfoCollection

好吧,如果有人有任何建议,我将不胜感激,在此先感谢您!

您是否更改了服务器场帐户的分布式缓存帐户? 您使用的是什么内部版本号? 这是单服务器场吗?

在我的脑海里,唯一剩下的就是:

Grant-CacheAllowedClientAccount -Account "domain\ProfileserviceWebAppIdentity"

我会在你 运行 这个命令后执行 iisreset 并重新启动 owtimer 服务。

这是一条一般性错误消息,意味着真正的问题尚不清楚(因此出现 "Probably" 这个词)。

我认为解决这个问题的关键是在 ULS 日志中查找它之前发生的事件。 "Unexpected" 类型的事件不会出现在事件日志中,并且经常出现在一般类型的错误之前。

在许多情况下,您可能会看到类似 "File not Found" 的内容。这通常意味着注意到的文件不在程序集缓存中。由于分布式缓存使用 Sharepoint 外部的 AppFabric,因此 Sharepoint 找到它的文件的唯一方法是查看程序集缓存。 Sharepoint pre Installer 应该将文件放在那里,但它可能已经失败,或者可能有人卸载了 App Fabric 并手动重新安装它,这会从程序集中删除文件而不是将它们放回去。

Restart-CacheCluster 之前,您可以指定与 SharePoint 数据库的连接(目录名称可以不同)

Use-CacheCluster -ConnectionString "Data Source=(SharePoint DB Server)
\(Optional Instance);Initial Catalog=CacheClusterConfigurationDB;
Integrated Security=True" -ProviderType System.Data.SqlClient

注意:它不会永久有效

注意 2: 如果您在数据库服务器上没有命名实例,只需输入您的服务器名称而不带“\”。

如果你没有目录,你可以按照这个脚本

***
Remove-Cache default
New-Cache SharePointCache
Get-CacheConfig SharePointCache
Set-CacheConfig SharePointCache -NotificationsEnabled True
***
New-CacheCluster -Provider System.Data.SqlClient -ConnectionString  "Data     Source=(SharePoint DB Server)\(Optional Instance);Initial Catalog=CacheClusterConfigurationDB;Integrated Security=True" -Size Small

Register-CacheHost -Provider System.Data.SqlClient -ConnectionString  "Data Source=(SharePoint DB Server)\(Optional Instance);Initial Catalog=CacheClusterConfigurationDB;Integrated Security=True"  -Account "Domain\spservices_account" -CachePort 22233 -ClusterPort 22234  -ArbitrationPort 22235 -ReplicationPort 22236 -HostName  [Name_of_your_server]

Add-CacheHost -Provider System.Data.SqlClient -ConnectionString  "Data Source=(SharePoint DB Server)\(Optional Instance);Initial Catalog=CacheClusterConfigurationDB;Integrated Security=True" -Account "Domain\spservices_account"

Add-CacheAdmin -Provider System.Data.SqlClient -ConnectionString  "Data Source=(SharePoint DB Server)\(Optional Instance);Initial Catalog=CacheClusterConfigurationDB;Integrated Security=True" 

Use-CacheCluster

您可以在注册表中指定或检查您的数据库配置

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AppFabric\V1.0\Configuration

查找 ConnectionString 字符串值,并设置您的连接字符串

Data Source=(SharePoint DB Server)\(Optional Instance);Initial Catalog=CacheClusterConfigurationDB;Integrated Security=True

要查询您可以使用的服务器的状态:

Get-SPServiceInstance | ? {($_.service.tostring()) -eq “SPDistributedCacheService Name=AppFabricCachingService”} | select Server, Status
Get-SPServer | ? {($_.ServiceInstances | % TypeName) -contains "Distributed Cache"} | % Address
Get-AFCache | Format-Table –AutoSize
Get-CacheHost

附加: 如果您需要更改您的服务帐户,您可以执行以下步骤:

$f = Get-SPFarm
$svc = $f.Services | ? {$_.Name -eq "AppFabricCachingService"}
$acc = Get-SPManagedAccount -Identity "Domain\spservices_account"
$svc.ProcessIdentity.CurrentIdentityType = "SpecificUser"
$svc.ProcessIdentity.ManagedAccount = $acc
$svc.ProcessIdentity.Update()
$svc.ProcessIdentity.Deploy()