Lucene索引备份 [英] Lucene index backup

查看:120
本文介绍了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索引备份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆