2015-10-01 129 views
0

我有,我認爲是一樣的,這裏所描述的問題:錯誤打開Lucene索引時:產生java.io.IOException:地圖失敗

Error when opening a lucene index: Map failed

但是該解決方案並不在此申請所以我提供了更多的細節,並再次詢問。

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

異常堆棧跟蹤是:

該指數是使用的Solr 5.3

的代碼產生例外的線是創建

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 =千萬

給出:「錯誤:關鍵'vm.max_map_count'的權限被拒絕'」

有沒有反正我可以解決這個問題?

謝謝

+0

聽起來像什麼,你應該問的是:爲什麼的ulimit是給你「操作不允許」(http://unix.stackexchange.com/questions/31679/ulimit -pickle-操作不許可和 - 命令未找到) – femtoRgon

回答

1

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

如果你真的不能設置的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())) 
相關問題