zwd 发表于 2016-12-14 08:35:29

solr 安装配置

下载:
下载地址:http://mirror.bit.edu.cn/apache/lucene/solr/  选择对应的版本(本次下载的是4.10.4)
windows下载:solr-4.10.4.zip Linux下载:solr-4.10.4.tgz
解压开后的目录说明:
    exapmle
        solr 配置了solr运行时信息是一个标准的solrhome目录。
        webapps-->solr.war
 
安装:
1,安装tomcat    
参考http://wangshirufeng.iyunv.com/blog/2242993
2,将solr.war部署到tomcat中
复制solr-4.10.4\example\webapps中的solr.war文件到tomcat安装目录中的webapps文件夹下
运行tomcat。tomcat会自动解压solr.war文件。
删除solr.war文件。(不然每次启动tomcat都会发布一次)
3,添加扩展依赖包到指定目录
打开文件夹:solr-4.10.4/example/lib/ext,复制所有jar包到tomcat的webapps/solr/WEB-INF/lib下。
4,添加log4j配置文件
将solr-4.10.4/example/resource下的log4j.properties文件到/webapps/solr/WEB-INF/classes下
5,在web.xml中指定solrhome的位置

<env-entry>
<env-entry-name>solr/home</env-entry-name>
<env-entry-value>E:\solrhome\solr</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
将solr-4.10.4\example\solr拷贝到E:/solrhome目录下
 
6, SolrCore配置      
  a,solr-4.10.4 下面的 contrib和dist文件夹拷贝到E:\solrhome目录下
  b,将SolrCore/conf/solrconfig.xml中的 
  <lib dir="${solr.install.dir:../../..}/contrib/extraction/lib" regex=".*\.jar" />
  <lib dir="${solr.install.dir:../../..}/dist/" regex="solr-cell-\d.*\.jar" />
  <lib dir="${solr.install.dir:../../..}/contrib/clustering/lib/" regex=".*\.jar" />
  <lib dir="${solr.install.dir:../../..}/dist/" regex="solr-clustering-\d.*\.jar" />
  <lib dir="${solr.install.dir:../../..}/contrib/langid/lib/" regex=".*\.jar" />
  <lib dir="${solr.install.dir:../../..}/dist/" regex="solr-langid-\d.*\.jar" />
  <lib dir="${solr.install.dir:../../..}/contrib/velocity/lib" regex=".*\.jar" />
  <lib dir="${solr.install.dir:../../..}/dist/" regex="solr-velocity-\d.*\.jar" />
  改为:
  <lib dir="${solr.install.dir:../..}/contrib/extraction/lib" regex=".*\.jar" />
  <lib dir="${solr.install.dir:../..}/dist/" regex="solr-cell-\d.*\.jar" />
  <lib dir="${solr.install.dir:../..}/contrib/clustering/lib/" regex=".*\.jar" />
  <lib dir="${solr.install.dir:../..}/dist/" regex="solr-clustering-\d.*\.jar" />
  <lib dir="${solr.install.dir:../..}/contrib/langid/lib/" regex=".*\.jar" />
  <lib dir="${solr.install.dir:../..}/dist/" regex="solr-langid-\d.*\.jar" />
  <lib dir="${solr.install.dir:../..}/contrib/velocity/lib" regex=".*\.jar" />
  <lib dir="${solr.install.dir:../..}/dist/" regex="solr-velocity-\d.*\.jar" />
  将solr-4.10.4下的contrib和dist文件夹拷贝到E:\solrhome目录下
 
  注意: 1,solr.install.dir 路径表示:E:\solrhome\solr\collection1
            2,这步操作不做也不会报错,但是在主界面的日志部分能有找不到资源的日志。 
     
 
启动tomcat后在浏览器地址输入http://localhost:8888/solr/#/ 可以看到SolrHome主页
 
 
配置多个SolrCore:
  1,复制collection1 并重命名为 collection2
  2,修改 collection2/core.properties 文件内容,将其改为:name=collection2
 
页: [1]
查看完整版本: solr 安装配置