Solr 实时系统上大索引增量备份

发布于 2024-09-06 13:53:20 字数 481 浏览 4 评论 0原文

我使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

掩饰不了的爱 2024-09-13 13:53:20

您可以使用 ReplicationHandler 进行热备份(即写入索引时),将 Solr 的数据目录复制到本地系统上的其他位置。然后对该目录执行任何您喜欢的操作。您可以随时通过访问如下 URL 来启动备份:

http://host:8080/solr/replication?command=backup&location=/home/jboss/backup

显然您可以使用 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:

http://host:8080/solr/replication?command=backup&location=/home/jboss/backup

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.

羞稚 2024-09-13 13:53:20

更新索引时不要运行备份。您可能会得到一个损坏的(因此无用的)备份。

解决这个问题的一些想法:

  • 批量更新,即不是一直添加/更新文档,而是每 n 分钟添加/更新。这将让您在 n 分钟之间运行备份。缺点:文档新鲜度受到影响。
  • 使用第二个被动 Solr 核心:为每个分片设置两个核心,一个主动,一个被动。所有查询都是针对活动核心发出的。使用复制使被动核心保持最新。针对被动核心运行备份。运行备份时,您必须禁用复制。缺点:复杂,移动部件较多,需要双倍的磁盘空间来维护被动核心。

Don't run a backup while updating the index. You will probably get a corrupt (therefore useless) backup.

Some ideas to work around it:

  • Batch up your updates, i.e. instead of adding/updating documents all the time, add/update every n minutes. This will let you run the backup in between those n minutes. Cons: document freshness is affected.
  • Use a second, passive Solr core: Set up two cores per shard, one active and one passive. All queries are issued against the active core. Use replication to keep the passive core up to date. Run the backup against the passive core. You'd have to disable replication while running the backup. Cons: complex, more moving parts, requires double the disk space to maintain the passive core.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文