linux安装solr

版权声明:本文为作者原创,转载请注明出处,联系qq:32248827 https://blog.csdn.net/dataiyangu/article/details/85266472

本文是solr-4.10.0,不同的版本方法略有不同

solr对jdk和tomcat的要求

https://www.cnblogs.com/gaoxu007/p/7210581.html

下载安装包

http://archive.apache.org/dist/lucene/solr/

安装

解压

ssh进入linux机器,将下载的安装包rz或者scp到linux机器,到安装包所在的目录(任意目录),解压。

ls
solr-4.10.1  solr-4.10.1.zip

放入tomcat

1.将solr-4.10.3/dist/solr-4.10.0.war重命名为solr.war,并复制到tomcat的webapps下
2.首次运行tomcat,将solr.war解压成文件夹,将solr-4.10.3/example/lib/ext/*复制到
tomcat目录/webapps/solr/WEB-INF/lib下。
3.自建一个目录,这里举例为/root/solr,将 solr-4.10.3/example/solr重命名为solrhome并复制到/root/solr。
4.修改tomcat目录/webapps/solr/WEB-INF/web.xml
将下面这段注释解开

<env-entry>
    <env-entry-name>solr/home</env-entry-name>
    <env-entry-value>替换为第3步中的solrhome目录我这里是/root/solr/solrhome</env-entry-value>
    <env-entry-type>java.lang.String</env-entry-type>
</env-entry>

5.在solrhome中创建/solrindex作为索引文件存放的目录
6.

vi /usr/solr/solrhome/collection1/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" /> -->//注释此段代码
......
//填入第五步中的solrindex的地址
  <dataDir>${solr.data.dir:/usr/solr/solrhome/solrindex}</dataDir>

7.访问http://10.0.1.225:8080/solr/#/
在这里插入图片描述

报错

HTTP Status 500 - {msg=SolrCore 'collection1' is not available due to init failure: Could not load core configuration for core 
collection1,trace=org.apache.solr.common.SolrException: SolrCore 'collection1' is not available due to init failure: Could not load core 
configuration for core collection1 at org.apache.solr.core.CoreContainer.getCore(CoreContainer.Java:753) at  

注意上面第四步中的slorhome的路径别写错了

<env-entry>
       <env-entry-name>solr/home</env-entry-name>
       <env-entry-value>slorhome</env-entry-value>
       <env-entry-type>java.lang.String</env-entry-type>
</env-entry>

猜你喜欢

转载自blog.csdn.net/dataiyangu/article/details/85266472