01_Solr

  • 分别上传solr-4.10.3.tgz.tgzapache-tomcat-7.0.47.tar.gz到linux的/opt/solr/opt/tomcat目录下
    这两个文件在本机的G:\Java\JavaEE\10_淘淘商城\参考资料\Solr\bin目录下
  • 解压两个文件
[root@training ~]# cd /opt/solr/
[root@training solr]# tar zxf solr-4.10.3.tgz.tgz
[root@training solr]# cd ../
[root@training opt]# cd tomcat/
[root@training tomcat]# tar zxf apache-tomcat-7.0.47.tar.gz
  • 将tomcat复制到solr安装(假设solr已安装好)目录下
[root@training tomcat]# cp -r apache-tomcat-7.0.47 /usr/local/taotao-servers/solr/tomcat
[root@training tomcat]# cd /usr/local/taotao-servers/solr/
[root@training solr]# ls -l
total 8
drwxr-xr-x.  4 root root 4096 Jun  2  2016 solrhome
drwxr-xr-x. 10 root root 4096 May  7 00:45 tomcat
  • 复制solr的war包到tomcat的webapp下面
[root@training solr]# cp /opt/solr/solr-4.10.3/dist/solr-4.10.3.war ./tomcat/webapps/solr.war
  • 启动tomcat解压solr.war
[root@training solr]# cd tomcat/
[root@training tomcat]# bin/startup.sh 
Using CATALINA_BASE:   /usr/local/taotao-servers/solr/tomcat
Using CATALINA_HOME:   /usr/local/taotao-servers/solr/tomcat
Using CATALINA_TMPDIR: /usr/local/taotao-servers/solr/tomcat/temp
Using JRE_HOME:        /usr/local/jdk1.7.0_55
Using CLASSPATH:       /usr/local/taotao-servers/solr/tomcat/bin/bootstrap.jar:/usr/local/taotao-servers/solr/tomcat/bin/tomcat-juli.jar
[root@training tomcat]# tail -f logs/catalina.out 
May 07, 2017 12:59:48 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /usr/local/taotao-servers/solr/tomcat/webapps/ROOT
May 07, 2017 12:59:48 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /usr/local/taotao-servers/solr/tomcat/webapps/host-manager
May 07, 2017 12:59:48 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8180"]
May 07, 2017 12:59:48 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8109"]
May 07, 2017 12:59:48 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 8016 ms
^C
[root@training tomcat]# ll webapps/
total 29072
drwxr-xr-x. 13 root root     4096 Jun  2  2016 docs
drwxr-xr-x.  7 root root     4096 Jun  2  2016 examples
drwxr-xr-x.  5 root root     4096 Jun  2  2016 host-manager
drwxr-xr-x.  5 root root     4096 Jun  2  2016 manager
drwxr-xr-x.  3 root root     4096 Jun  2  2016 ROOT
drwxr-xr-x.  8 root root     4096 Jun  2  2016 solr
-rw-r--r--.  1 root root 29741796 May  7 00:58 solr.war
[root@training tomcat]# 
  • 关闭tomcat,删除solr.war
[root@training tomcat]# bin/shutdown.sh 
Using CATALINA_BASE:   /usr/local/taotao-servers/solr/tomcat
Using CATALINA_HOME:   /usr/local/taotao-servers/solr/tomcat
Using CATALINA_TMPDIR: /usr/local/taotao-servers/solr/tomcat/temp
Using JRE_HOME:        /usr/local/jdk1.7.0_55
Using CLASSPATH:       /usr/local/taotao-servers/solr/tomcat/bin/bootstrap.jar:/usr/local/taotao-servers/solr/tomcat/bin/tomcat-juli.jar
[root@training tomcat]# rm -f webapps/solr.war
[root@training tomcat]# ll webapps/
total 24
drwxr-xr-x. 13 root root 4096 Jun  2  2016 docs
drwxr-xr-x.  7 root root 4096 Jun  2  2016 examples
drwxr-xr-x.  5 root root 4096 Jun  2  2016 host-manager
drwxr-xr-x.  5 root root 4096 Jun  2  2016 manager
drwxr-xr-x.  3 root root 4096 Jun  2  2016 ROOT
drwxr-xr-x.  8 root root 4096 Jun  2  2016 solr
[root@training tomcat]# 
  • 复制solr的jar包到tomcat的solr中
[root@training tomcat]# cp /opt/solr/solr-4.10.3/example/lib/ext/* ./webapps/solr/WEB-INF/lib/
  • 修改tomcat中solr的web.xml文件
[root@training tomcat]# vi webapps/solr/WEB-INF/web.xml

默认是注释了,将注释打开,并修改如下:

    
       solr/home
       /usr/local/taotao-servers/solr/solrhome
       java.lang.String
    

你可能感兴趣的:(01_Solr)