Solr索引数据存放到HDFS下
一 新建solr core hdfs
方法:http://www.cnblogs.com/Matchman/p/7287385.html
二 修改solrconfig.xml文件
文件地址:/usr/local/tomcat/apache-tomcat-8.5.13/solr_home/hdfs/conf/solrconfig.xml
vi /usr/local/tomcat/apache-tomcat-8.5.13/solr_home/hdfs/conf/solrconfig.xml
1 将原文件中<directoryFactory>...</directoryFactory>配置修改成如下:
<directoryFactory name="DirectoryFactory" class="solr.HdfsDirectoryFactory"> <str name="solr.hdfs.home">hdfs://192.168.3.111:9000/news</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>
(注):solr.hdfs.home中配置的为Hadoop的HDFS的访问路劲
2 将原文件中<<lockType>>...</<lockType>>配置修改成如下:
<lockType>${solr.lock.type:hdfs}</lockType>
三 替换Jar包
1 从Hadoop中获取以下四个jar包
hadoop-2.6.5/share/hadoop/common/hadoop-common-2.6.5.jar hadoop-2.6.5/share/hadoop/hdfs/hadoop-hdfs-2.6.5.jar hadoop-2.6.5/share/hadoop/common/lib/hadoop-auth-2.6.5.jar hadoop-2.6.5/share/hadoop/common/lib/hadoop-annotations-2.6.5.jar
2 下载protobuf-java-2.5.0.jar包
下载地址:http://download.csdn.net/download/u013292160/9936638
3 删除Jar包
目录:/usr/local/tomcat/apache-tomcat-8.5.13/webapps/solr/WEB-INF/lib rm hadoop-*.jar rm protobuf-java-2.5.0.jar
4上传Jar包
将Hadoop中获取的四个Jar包和下载的Jar包上传
四 重启tomcat访问Solr客户端
cd /usr/local/tomcat/apache-tomcat-8.5.13/bin/ ./startup.sh