Solr 实时系统上大索引增量备份
我使用 solr 实现搜索引擎,每天至少导入 200 万个文档。 用户必须能够尽快(近乎实时)搜索导入的文档。
我使用 2 个专用 Windows x64 和 tomcat 6(Solr 分片模式)。每台服务器,索引约1.2亿个文档,约220GB(总计500GB)。
我想在更新或搜索期间从 solr 索引文件获取备份增量。
搜索后,找到适用于UNIX的rsync工具和适用于Windows的DeltaCopy(GUI rsync 适用于 Windows)。但在更新过程中出现错误(消失)。
如何解决这个问题。
注意1:当文件大小非常大时,文件复制非常慢。因此我不能使用这种方式。
注2:如果 Windows 崩溃或硬件重置或任何其他问题,我可以防止更新期间索引文件损坏吗?
I implement search engine with solr that import minimal 2 million doc per day.
User must can search on imported doc ASAP (near real-time).
I using 2 dedicated Windows x64 with tomcat 6 (Solr shard mode). every server, index about 120 million doc and about 220 GB (total 500 GB).
I want to get backup incremental from solr index file during update or search.
after search it, find rsync tools for UNIX and DeltaCopy for windows (GUI rsync for windows). but get error (vanished) during update.
how to solve this problem.
Note1:File copy really slow, when file size very large. therefore i can't use this way.
Note2: Can i prevent corrupt index files during update, if windows crash or hardware reset or any other problem ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 ReplicationHandler 进行热备份(即写入索引时),将 Solr 的数据目录复制到本地系统上的其他位置。然后对该目录执行任何您喜欢的操作。您可以随时通过访问如下 URL 来启动备份:
显然您可以使用 wget+cron 编写脚本。
更多详细信息可以在这里找到:
http://wiki.apache.org/solr/SolrReplication
《Lucene in Action》书中有一节介绍了 Lucene 的热备份,在我看来,Solr 的 ReplicationHandler 中的代码使用了与那里概述的相同的策略。该书的一位作者甚至在另一个 StackOverflow 答案中详细阐述了它的工作原理。
You can take a hot backup (i.e. while writing to the index) using the ReplicationHandler to copy Solr's data directory elsewhere on the local system. Then do whatever you like with that directory. You can launch the backup whenever you want by going to a URL like this:
Obviously you could script that with wget+cron.
More details can be found here:
http://wiki.apache.org/solr/SolrReplication
The Lucene in Action book has a section on hot backups with Lucene, and it appears to me that the code in Solr's ReplicationHandler uses the same strategy as outlined there. One of that book's authors even elaborated on how it works in another StackOverflow answer.
更新索引时不要运行备份。您可能会得到一个损坏的(因此无用的)备份。
解决这个问题的一些想法:
Don't run a backup while updating the index. You will probably get a corrupt (therefore useless) backup.
Some ideas to work around it: