Solr官网:http://lucene.apache.org/solr/

0、环境及各文件下载地址

1、 CentOS 6.5 X64

2、 jdk-8u161-linux-x64.tar.gz

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
http://cdn.zhangguoli.cn/solr/jdk-8u161-linux-x64.tar.gz

3、 apache-tomcat-8.0.52.tar.gz

https://archive.apache.org/dist/tomcat/tomcat-8/
https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.52/bin/apache-tomcat-8.0.52.tar.gz

4、 solr-6.6.3.tgz

http://lucene.apache.org/solr/downloads.html
http://cdn.zhangguoli.cn/solr/solr-6.6.3.tgz

1、JDK安装及配置

参考 CentOS6.5 安装JDK 、Tomcat

2、Solr环境搭建及配置

1、解压apache-tomcat-8.0.52.tar.gzsolr-6.6.3.tgz

tar -zxvf apache-tomcat-8.0.52.tar.gz
tar -zxvf solr-6.6.3.tgz

解压后目录:

apache-tomcat-8.0.52  apache-tomcat-8.0.52.tar.gz  solr-6.6.3  solr-6.6.3.tgz

2、搭建solr运行环境

cd /opt/solr-6.6.3/

以下路径基于/opt/solr-6.6.3/


server/solr-webapp/webapp文件夹下所有文件复制到/opt/apache-tomcat-8.0.52/webapps/目录下,文件夹名改成solr

cp -R server/solr-webapp/webapp/ /opt/apache-tomcat-8.0.52/webapps/
mv /opt/apache-tomcat-8.0.52/webapps/webapp/ /opt/apache-tomcat-8.0.52/webapps/solr

server/lib/ext中的jarlib目录下以metrics-开头的jar复制到/opt/apache-tomcat-8.0.52/webapps/solr/WEB-INF/lib/

cp -R server/lib/ext/*.jar /opt/apache-tomcat-8.0.52/webapps/solr/WEB-INF/lib/
cp -R server/lib/metrics-*.jar /opt/apache-tomcat-8.0.52/webapps/solr/WEB-INF/lib/

复制dist目录下solr-dataimporthandler开头的jar/opt/apache-tomcat-8.0.52/webapps/solr/WEB-INF/lib/

cp -R dist/solr-dataimporthandler-*.jar /opt/apache-tomcat-8.0.52/webapps/solr/WEB-INF/lib/

/opt/apache-tomcat-8.0.52/webapps/solr/WEB-INF/下创建classes目录

mkdir -p /opt/apache-tomcat-8.0.52/webapps/solr/WEB-INF/classes

复制server/resources/log4j.properties到刚创建的classes

cp server/resources/log4j.properties /opt/apache-tomcat-8.0.52/webapps/solr/WEB-INF/classes/

搭建solr home基本环境

mkdir -p /opt/solr_home
cp -R server/solr/* /opt/solr_home/

编辑web.xml,配置solr home路径和访问权限

vim /opt/apache-tomcat-8.0.52/webapps/solr/WEB-INF/web.xml

配置solr home的路径,并去掉env-entry前后的注释

<env-entry>
   <env-entry-name>solr/home</env-entry-name>
   <!--solr home 的路径-->
   <env-entry-value>/opt/solr_home</env-entry-value>
   <env-entry-type>java.lang.String</env-entry-type>
</env-entry>

配置访问权限,在security-constraint前后增加注释

  <!-- Get rid of error message -->
  <!--
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Disable TRACE</web-resource-name>
      <url-pattern>/</url-pattern>
      <http-method>TRACE</http-method>
    </web-resource-collection>
    <auth-constraint/>
  </security-constraint>
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Enable everything but TRACE</web-resource-name>
      <url-pattern>/</url-pattern>
      <http-method-omission>TRACE</http-method-omission>
    </web-resource-collection>
  </security-constraint>
  -->

3、Solr运行

启动tomcat

Using CATALINA_BASE:   /opt/apache-tomcat-8.0.52
Using CATALINA_HOME:   /opt/apache-tomcat-8.0.52
Using CATALINA_TMPDIR: /opt/apache-tomcat-8.0.52/temp
Using JRE_HOME:        /opt/jdk1.8.0_161
Using CLASSPATH:       /opt/apache-tomcat-8.0.52/bin/bootstrap.jar:/opt/apache-tomcat-8.0.52/bin/tomcat-juli.jar
Tomcat started.

访问http://127.0.0.1:8080/solr/index.html(以IP和端口以本机环境为准)

solrindex.jpg

标签: solr

添加新评论