繁体   English   中英

打开lucene索引时出错:java.io.IOException:映射失败

[英]error when opening a lucene index: java.io.IOException: Map failed

我有一个与这里描述的问题相同的问题:

打开lucene索引时出错:映射失败

但是,该解决方案不适用于这种情况,因此我提供了更多详细信息并再次询问。

使用Solr 5.3创建索引

导致异常的代码行是:

IndexReader indexReader = DirectoryReader.open(FSDirectory.open(Paths.get("the_path")));

异常堆栈跟踪为:

Exception in thread "main" java.io.IOException: Map failed: MMapIndexInput(path="/mnt/fastdata/ac1zz/JATE/solr-5.3.0/server/solr/jate/data_aclrd/index/_5t.tvd") [this may be caused by lack of enough unfragmented virtual address space or too restrictive virtual memory limits enforced by the operating system, preventing us to map a chunk of 434505698 bytes. Please review 'ulimit -v', 'ulimit -m' (both should return 'unlimited'), and 'sysctl vm.max_map_count'. More information: http://blog.thetaphi.de/2012/07/use-lucenes-mmapdirectory-on-64bit.html]
at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:907)
at org.apache.lucene.store.MMapDirectory.map(MMapDirectory.java:265)
at org.apache.lucene.store.MMapDirectory.openInput(MMapDirectory.java:239)
at org.apache.lucene.codecs.compressing.CompressingTermVectorsReader.<init>(CompressingTermVectorsReader.java:144)
at org.apache.lucene.codecs.compressing.CompressingTermVectorsFormat.vectorsReader(CompressingTermVectorsFormat.java:91)
at org.apache.lucene.index.SegmentCoreReaders.<init>(SegmentCoreReaders.java:120)
at org.apache.lucene.index.SegmentReader.<init>(SegmentReader.java:65)
at org.apache.lucene.index.StandardDirectoryReader$1.doBody(StandardDirectoryReader.java:58)
at org.apache.lucene.index.StandardDirectoryReader$1.doBody(StandardDirectoryReader.java:50)
at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:731)
at org.apache.lucene.index.StandardDirectoryReader.open(StandardDirectoryReader.java:50)
at org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:63)
at uk.ac.shef.dcs.jate.app.AppATTF.extract(AppATTF.java:39)
at uk.ac.shef.dcs.jate.app.AppATTF.main(AppATTF.java:33)

在这种情况下,建议的解决方案(如异常消息)无法正常工作,因为我正在服务器上运行该应用程序,并且我没有更改这些权限。

ulimit -v unlimited

打印:“-bash:ulimit:虚拟内存:无法修改限制:不允许的操作”

和sysctl -w vm.max_map_count = 10000000

给出:“错误:键'vm.max_map_count'的权限被拒绝”

反正有什么我可以解决的?

谢谢

我已经找到了解决方案,所以我正在回答自己。

如果您确实无法设置ulimit或vm.max_map_count,则根据http://blog.thetaphi.de/2012/07/use-lucenes-mmapdirectory-on-64bit.html的唯一解决方案是配置solr(或如果您使用Lucene api,请显式选择)以使用SimpleFSDirectory(如果是Windows)或NIOFSDirectory,两者均比默认速度慢。

例如

DirectoryReader.open(new NIOFSDirectory(Paths.get("path_to_index"), FSLockFactory.getDefault()))

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM