TFS 代码搜索服务器(弹性搜索)的保留策略
Retention policy to TFS Code Search Server (Elastic Search)
我们有带有独立代码搜索服务器的 TFS 2017.3。
我们有巨大的 TFS 数据库(约 1.6TB),在代码搜索服务器中我们有 700GB 磁盘 space。
几个星期后,磁盘 space 运行 出来了,代码搜索在 tfs 中不起作用。
增加磁盘后 space 搜索恢复工作。
我们如何制定保留策略来删除旧代码搜索数据(索引)?我们不想增加更多磁盘 space.
Search indexing (Code and Work Item) works in 2 phases:
- Bulk Indexing (BI) where the entire code and work item artifacts in all projects/repositories under a Collection are indexed. This is a
time consuming operation and depends on the size of the artifacts
under the collection.
- Continuous Indexing (CI) which handles all incremental updates to the artifacts (add/updated/delete) and indexes them. This is
notification based model where the indexer listens to TFS events
and operates based on those event notifications. CI handles almost
all update operations including CRUD operations at
Project/Repository/Collection layer (such as Repository renames,
Project add/deletes, etc.). The operation time for these CI would
depend again on the size of the incremental update. BI always
precedes CI i.e. a CI will never execute on a project/repository
until BI is completed for the same.
如何Clean-up索引数据和Re-index请按照以下步骤操作:
- 暂停所有 collection 的索引。 运行 TFS 上的以下脚本
配置数据库
https://github.com/Microsoft/Code-Search/blob/master/PauseIndexing.ps1
- 登录Elasticsearch(ES)所在的机器运行
- 停止 ES 服务
- 删除整个搜索索引文件夹(例如,
C:\TfsData\Search\IndexStore,或者你配置它的任何地方
是)
- 重新启动 AT 机器上的 TFS 作业代理服务
- 从每个 collection 个数据库中删除以下表格
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_ResourceLockTable]
- 重启ES服务
- 运行 TFS 配置数据库上的这个脚本:
https://github.com/Microsoft/Code-Search/blob/master/ResumeIndexing.ps1
- 运行 每个脚本(从正确的 TFS 发布文件夹中选择)
collections:
https://github.com/Microsoft/Code-Search/blob/master/TFS_2017Update2/MissingIndexFolderTriggerCollectionIndexing.ps1
- 首先在较小的 collection 上尝试最后一个脚本(它有更少的
存储库的数量),以便您可以验证索引是否发生
正确,结果为 query-able.
更多详细信息请参阅 MSDN 中的此博客:Resetting Search Index in Team Foundation Server
在删除 ES 文件夹、重新安装代码搜索扩展后,我能够减小磁盘大小,有时不得不 运行 MissingIndexFolderTriggerCollectionIndexing.ps1
。
但是 - 我得出的结论是不值得做,磁盘大小快速增长并达到原始大小,所以我没有保存任何东西。
虽然微软建议给磁盘 space 35% 的 DB,但这对我们来说不够,我们会在磁盘已满时增加大小(目前大约是 DB 大小的 45% ).
结论-不要动ES,如果磁盘满了就增加磁盘大小。
我们有带有独立代码搜索服务器的 TFS 2017.3。
我们有巨大的 TFS 数据库(约 1.6TB),在代码搜索服务器中我们有 700GB 磁盘 space。
几个星期后,磁盘 space 运行 出来了,代码搜索在 tfs 中不起作用。
增加磁盘后 space 搜索恢复工作。 我们如何制定保留策略来删除旧代码搜索数据(索引)?我们不想增加更多磁盘 space.
Search indexing (Code and Work Item) works in 2 phases:
- Bulk Indexing (BI) where the entire code and work item artifacts in all projects/repositories under a Collection are indexed. This is a
time consuming operation and depends on the size of the artifacts
under the collection.- Continuous Indexing (CI) which handles all incremental updates to the artifacts (add/updated/delete) and indexes them. This is notification based model where the indexer listens to TFS events and operates based on those event notifications. CI handles almost all update operations including CRUD operations at Project/Repository/Collection layer (such as Repository renames, Project add/deletes, etc.). The operation time for these CI would depend again on the size of the incremental update. BI always precedes CI i.e. a CI will never execute on a project/repository until BI is completed for the same.
如何Clean-up索引数据和Re-index请按照以下步骤操作:
- 暂停所有 collection 的索引。 运行 TFS 上的以下脚本 配置数据库 https://github.com/Microsoft/Code-Search/blob/master/PauseIndexing.ps1
- 登录Elasticsearch(ES)所在的机器运行
- 停止 ES 服务
- 删除整个搜索索引文件夹(例如, C:\TfsData\Search\IndexStore,或者你配置它的任何地方 是)
- 重新启动 AT 机器上的 TFS 作业代理服务
- 从每个 collection 个数据库中删除以下表格
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_ResourceLockTable]
- 重启ES服务
- 运行 TFS 配置数据库上的这个脚本: https://github.com/Microsoft/Code-Search/blob/master/ResumeIndexing.ps1
- 运行 每个脚本(从正确的 TFS 发布文件夹中选择) collections: https://github.com/Microsoft/Code-Search/blob/master/TFS_2017Update2/MissingIndexFolderTriggerCollectionIndexing.ps1
- 首先在较小的 collection 上尝试最后一个脚本(它有更少的 存储库的数量),以便您可以验证索引是否发生 正确,结果为 query-able.
更多详细信息请参阅 MSDN 中的此博客:Resetting Search Index in Team Foundation Server
在删除 ES 文件夹、重新安装代码搜索扩展后,我能够减小磁盘大小,有时不得不 运行 MissingIndexFolderTriggerCollectionIndexing.ps1
。
但是 - 我得出的结论是不值得做,磁盘大小快速增长并达到原始大小,所以我没有保存任何东西。
虽然微软建议给磁盘 space 35% 的 DB,但这对我们来说不够,我们会在磁盘已满时增加大小(目前大约是 DB 大小的 45% ).
结论-不要动ES,如果磁盘满了就增加磁盘大小。