将 TFS 服务器升级到 2018 更新 2 后,搜索和索引似乎在我们的一个环境中被破坏。
任何搜索都会给出“我们在处理您的请求时遇到意外错误”,我已经完成了所有故障排除文档,以清理和重新索引所有集合。还将搜索包完全重新安装到我们为搜索和索引运行的单独服务器上,以确保我们运行的是正确的版本。
在 TFS 应用服务器的事件日志中记录了大量的异常:
Events (81277) completed with status FailedAndRetry. Event 81277 completed with message 'BeginBulkIndex-PushEventNotification: The operation did not complete successfully because of exception Microsoft.VisualStudio.Services.Search.Common.FeederException: Lots of files rejected by Elasticsearch, failing this job. Failure Reason : Microsoft.VisualStudio.Services.Search.Common.SearchPlatformException: ES Exception: [HTTP Status Code: [200] BULK_API_ERROR: [ index returned 404 _index: codesearchshared_1_0 _type: SourceNoDedupeFileContractV3 _version: 0 error: Type: type_missing_exception Reason: "type[SourceNoDedupeFileContractV3] missing"
另一种异常类型也记录了很多次,表明索引工作项失败:
Microsoft.VisualStudio.Services.Search.Common.SearchPlatformException: ES Exception: [HTTP Status Code: [200] BULK_API_ERROR: [ update returned 404 _index: workitemsearchshared_0_2 _type: workItemContract _version: 0 error: Type: type_missing_exception Reason: "type[workItemContract] missing" update returned 404 _index: workitemsearchshared_0_2 _type: workItemContract _version: 0 error: Type: type_missing_exception Reason: "type[workItemContract] missing"
异常似乎表明缺少某些类型注册,如 workItemContract 和 SourceNoDedupeFileContractV3,但我在搜索服务器安装日志中找不到任何错误。
有人对如何解决这个问题并让 Elastic Search 恢复工作状态有什么建议吗?
最佳答案
我们通过完全卸载然后重新安装与搜索相关的所有内容来解决这种情况。
- 从网络管理中的扩展管理中卸载所有集合中的所有 Code/Work/Wiki 扩展
- 从 TFS 管理控制台中删除了 TFS 搜索服务功能。
- 使用 PowerShell 脚本从单独的搜索服务器卸载了 elasticsearch 服务。\Configure-TFSSearch.ps1 -operation remove
重新启动 TFS 作业代理服务
使用
从所有集合数据库中删除旧的搜索相关数据库内容DELETE FROM [Search].[tbl_IndexingUnit]
DELETE FROM [Search].[tbl_IndexingUnitChangeEvent]
DELETE FROM [Search].[tbl_IndexingUnitChangeEventArchive]
DELETE FROM [Search].[tbl_JobYield]
DELETE FROM [Search].[tbl_TreeStore]
DELETE FROM [Search].[tbl_DisabledFiles]
DELETE FROM [Search].[tbl_ItemLevelFailures]
DELETE FROM [Search].[tbl_ResourceLockTable]
重新启动 TFS 作业代理服务
重启搜索服务器
使用现有搜索服务器从 TFS 管理控制台运行配置搜索功能向导
根据PowerShell脚本指令安装搜索包
.\Configure-TFSSearch.ps1 -Operation install -TFSSearchInstallPath D:\ES -TFSSearchIndexPath D:\ESDATA -Port 9200 -Verbose
从 TFS 管理控制台完成搜索配置向导,启用对所有现有集合的代码搜索
已检查服务是否正在运行并测试了从 Web 应用程序进行的搜索,一切正常!
关于elasticsearch - 升级到 TFS 2018 Update 2 后搜索失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51024632/