Solr部署到Tomcat

一、版本選擇html

solr-5.3.1.tgz
apache-tomcat-8.0.29.tar.gz

 

二、解壓tomcat和solrjava

[root@iZ23exixsjaZ solr]# tar -zxvf apache-tomcat-8.0.29.tar.gz 
[root@iZ23exixsjaZ solr]# tar -zxvf solr-5.3.1.tgz 

 

三、複製solr項目到tomcatweb

  1)將/solr-5.3.1/server/solr-webapp目錄下的webapp複製到tomcat的webapps目錄中apache

[root@iZ23exixsjaZ solr-webapp]# pwd
/luxh/solr/solr-5.3.1/server/solr-webapp
[root@iZ23exixsjaZ solr-webapp]# ls
webapp
[root@iZ23exixsjaZ solr-webapp]# cp -r webapp/ /luxh/solr/apache-tomcat-8.0.29/webapps/

  2)將複製到tomcat中的webapp更名爲solrtomcat

[root@iZ23exixsjaZ solr-webapp]# cd /luxh/solr/apache-tomcat-8.0.29/webapps
[root@iZ23exixsjaZ webapps]# ls
docs  examples  host-manager  manager  ROOT  webapp
[root@iZ23exixsjaZ webapps]# mv webapp/ solr
[root@iZ23exixsjaZ webapps]# ls
docs  examples  host-manager  manager  ROOT  solr
[root@iZ23exixsjaZ webapps]# 

 

四、創建solr根目錄app

[root@iZ23exixsjaZ solr]# mkdir solr_home
[root@iZ23exixsjaZ solr]# cd solr_home/
[root@iZ23exixsjaZ solr_home]# pwd
/luxh/solr/solr_home

  將solr-5.3.1/server/solr目錄下的全部文件拷貝到solr根目錄webapp

[root@iZ23exixsjaZ solr]# pwd
/luxh/solr/solr-5.3.1/server/solr
[root@iZ23exixsjaZ solr]# ls
configsets  README.txt  solr.xml  zoo.cfg
[root@iZ23exixsjaZ solr]# cp -r /luxh/solr/solr-5.3.1/server/solr/* /luxh/solr/solr_home/
[root@iZ23exixsjaZ solr]# 

 

五、配置tomcat中的solr項目spa

  1)修改solr項目的web.xml文件code

[root@iZ23exixsjaZ WEB-INF]# pwd
/luxh/solr/apache-tomcat-8.0.29/webapps/solr/WEB-INF
[root@iZ23exixsjaZ WEB-INF]# vi web.xml 

  去掉<env-entry>的註釋,並將<env-entry-value>的值設置爲以前創建solr的根目錄server

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

  2)將solr-5.3.1/server/lib/ext目錄下的全部jar包拷貝的solr項目中

[root@iZ23exixsjaZ ext]# cp -r /luxh/solr/solr-5.3.1/server/lib/ext/* /luxh/solr/apache-tomcat-8.0.29/webapps/solr/WEB-INF/lib/
[root@iZ23exixsjaZ ext]# 

  3)將solr-5.3.1/server/resources目錄中的log4j.properties拷貝的solr項目中

    先建立classes文件夾

[root@iZ23exixsjaZ WEB-INF]# pwd
/luxh/solr/apache-tomcat-8.0.29/webapps/solr/WEB-INF
[root@iZ23exixsjaZ WEB-INF]# ls
lib  weblogic.xml  web.xml
[root@iZ23exixsjaZ WEB-INF]# mkdir classes
[root@iZ23exixsjaZ WEB-INF]# ls
classes  lib  weblogic.xml  web.xml
[root@iZ23exixsjaZ WEB-INF]# 

    拷貝log4j.properties

[root@iZ23exixsjaZ resources]# pwd
/luxh/solr/solr-5.3.1/server/resources
[root@iZ23exixsjaZ resources]# ls
jetty-logging.properties  log4j.properties
[root@iZ23exixsjaZ resources]# cp log4j.properties /luxh/solr/apache-tomcat-8.0.29/webapps/solr/WEB-INF/classes
[root@iZ23exixsjaZ resources]# 

 

六、啓動tomcat

[root@iZ23exixsjaZ apache-tomcat-8.0.29]# pwd
/luxh/solr/apache-tomcat-8.0.29
[root@iZ23exixsjaZ apache-tomcat-8.0.29]# bin/startup.sh 

 

七、訪問 http://你的ip:8080/solr/admin.html ,出現以下界面,說明部署成功。

相關文章
相關標籤/搜索