我试图使Solr4.7.2与hdfs一起工作(使用Hadoop2.4.1)。
这里是 solrconfig.xml
:
<?xml version='1.0' encoding='UTF-8' ?>
<config>
<luceneMatchVersion>LUCENE_47</luceneMatchVersion>
<lockType>hdfs</lockType>
<unlockOnStartup>true</unlockOnStartup>
<writeLockTimeout>20000</writeLockTimeout>
<commitLockTimeout>10000</commitLockTimeout>
<directoryFactory name="DirectoryFactory" class="solr.HdfsDirectoryFactory">
<str name="solr.hdfs.home">hdfs://localhost:54310/solr</str>
<bool name="solr.hdfs.blockcache.enabled">true</bool>
<int name="solr.hdfs.blockcache.slab.count">1</int>
<bool name="solr.hdfs.blockcache.direct.memory.allocation">true</bool>
<int name="solr.hdfs.blockcache.blocksperbank">16384</int>
<bool name="solr.hdfs.blockcache.read.enabled">true</bool>
<bool name="solr.hdfs.blockcache.write.enabled">true</bool>
<bool name="solr.hdfs.nrtcachingdirectory.enable">true</bool>
<int name="solr.hdfs.nrtcachingdirectory.maxmergesizemb">16</int>
<int name="solr.hdfs.nrtcachingdirectory.maxcachedmb">192</int>
</directoryFactory>
<requestHandler name='standard' class=
'solr.StandardRequestHandler' default='true' />
<requestHandler name='/update' class=
'solr.UpdateRequestHandler' />
<requestHandler name='/admin/' class=
'org.apache.solr.handler.admin.AdminHandlers' />
<admin>
<defaultQuery>*:*</defaultQuery>
</admin>
</config>
一旦启动solr server,它就会抛出异常:
hdp1: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Error opening new searcher
我尝试调试,在jetty日志中发现以下错误:
Caused by: org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out:
NativeFSLock@hdfs:/localhost:54310/solr/hdp1/data/index/HdfsDirectory@1d5821fa lockFactory=NativeFSLockFactory@hdfs:/localhost:54310/solr/hdp1/data/index-write.lock: java.io.FileNotFoundException: hdfs:/localhost:54310/solr/hdp1/data/index/HdfsDirectory@1d5821fa lockFactory=NativeFSLockFactory@hdfs:/localhost:54310/solr/hdp1/data/index-write.lock (No such file or directory)
它能够在hdfs上创建目录,但在创建/访问时却失败了
索引。
1条答案
按热度按时间mnemlml81#
您需要设置-dsolr.lock.type=hdfs。