Lucene index backup(Lucene 索引备份)
问题描述
在不使索引脱机(热备份)的情况下备份 lucene 索引的最佳做法是什么?
What is the best practice to backup a lucene index without taking the index offline (hot backup)?
推荐答案
您不必为了备份索引而停止 IndexWriter.
You don't have to stop your IndexWriter in order to take a backup of the index.
只需使用 SnapshotDeletionPolicy,它可以让您保护"给定的提交点(及其包含的所有文件)不被删除.然后,将该提交点中的文件复制到您的备份,最后释放提交.
Just use the SnapshotDeletionPolicy, which lets you "protect" a given commit point (and all files it includes) from being deleted. Then, copy the files in that commit point to your backup, and finally release the commit.
如果备份需要一段时间才能运行,这很好——只要您不使用 SnapshotDeletionPolicy 释放提交点,IndexWriter 就不会删除文件(例如,即使它们已经合并在一起).
It's fine if the backup takes a while to run -- as long as you don't release the commit point with SnapshotDeletionPolicy, the IndexWriter will not delete the files (even if, eg, they have since been merged together).
这为您提供了一致的备份,它是索引的时间点映像,不会阻塞正在进行的索引.
This gives you a consistent backup which is a point-in-time image of the index without blocking ongoing indexing.
我在 Lucene in Action(第 2 版)中对此进行了介绍,并且有从 http://提供(免费)的书中摘录的论文www.manning.com/hatcher3,使用 Lucene 进行热备份",对此进行了更详细的描述.
I wrote about this in Lucene in Action (2nd edition), and there's paper excerpted from the book available (free) from http://www.manning.com/hatcher3, "Hot Backups with Lucene", that describes this in more detail.
这篇关于Lucene 索引备份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Lucene 索引备份


基础教程推荐
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- 降序排序:Java Map 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01
- Java:带有char数组的println给出乱码 2022-01-01
- 如何使用 Java 创建 X509 证书? 2022-01-01
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01