如何从 Solr 删除的索引文件中恢复? [英] How to recover from Solr deleted index files?

查看:21
本文介绍了如何从 Solr 删除的索引文件中恢复?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我删除磁盘上的 solr 索引文件时,(在 /solr/data/indexsolr/data/spellchecker 中找到),每当我尝试时,solr 都会抛出异常向它发出请求:

When I delete solr's index files on disk, (found in /solr/data/index and solr/data/spellchecker), solr throws an exception whenever I try to make a request to it:

java.lang.RuntimeException: java.io.FileNotFoundException: 在 org.apache.lucene.store.NIOFSDirectory@/.../solr/data/index: 中没有找到segments* 文件:

java.lang.RuntimeException: java.io.FileNotFoundException: no segments* file found in org.apache.lucene.store.NIOFSDirectory@/…/solr/data/index:

我发现从中恢复的唯一方法是使用来自其他地方的索引文件播种"data 目录.它看起来在哪里并不重要.执行此操作后,我可以运行查询以重新加载架构并重新生成索引.这是应该的工作方式吗?似乎应该有一种方法可以告诉 solr 从头开始​​重新生成这些文件.也许我只是错误地假设这些文件不是应用程序本身的一部分(有点由名称数据"暗示)?

The only way I've found to recover from this is to "seed" the data directory with the index files from elsewhere. It doesn't really matter where it seems. Once I do this, I can run a query to reload the schema and regenerate the index. Is this how this is supposed to work? It seems like there should be a way to tell solr to regenerate those files from scratch. Maybe I'm just mistaken in my assumption that these files are not part of the application itself (kind of implied by the name "data")?

推荐答案

如果 index 目录存在但为空,Solr 将在启动时抛出该异常.但是,如果您删除该目录,Solr 将在启动时创建它和空的段文件.

Solr will throw that exception at startup if the index directory exists but is empty. However if you delete the directory, Solr will create it and the empty segments files at startup.

这篇关于如何从 Solr 删除的索引文件中恢复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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