zoukankan      html  css  js  c++  java
  • centos solr 部署到 tomcat 上

    一、安装 java1.7 环境

      链接:https://pan.baidu.com/s/1ti6j9jD-RwUN5xl3bc3ZDw 密码:oc9a

    二、下载 tomcat 并解压

      链接:https://pan.baidu.com/s/1-TK3AAVtJCRWyhb86i7cRw 密码:zro9

    [root@localhost 桌面]# tar -zxvf apache-tomcat-7.0.47

    三、下载 solr 安装包并解压

      链接:https://pan.baidu.com/s/1-fBmxm64y19WUtPSc1Lxdw 密码:wddz

    [root@localhost 桌面]# tar -zxvf solr-4.10.3

    四、在 /usr/local 目录下创建 solr 目录

    [root@localhost 桌面]# mkdir /usr/local/solr

    五、将解压后的 tomcat 复制到 solr 目录中,并重命名为 tomcat

    [root@localhost 桌面]# mv apache-tomcat-7.0.47 /usr/local/solr/tomcat -r

    六、将 solr-4.10.3.war 复制到 tomcat 中

    [root@localhost solr-4.10.3]# cp dist/solr-4.10.3.war /usr/local//solr/tomcat/webapps/solr.war

    七、启动 tomcat

    [root@localhost tomcat]# bin/startup.sh

    八、查看 tomcat 是否成功启动

    [root@localhost tomcat]# tail -f logs/catalina.out

    九、关闭 tomcat 

    [root@localhost tomcat]# bin/shutdown.sh

    十、删除掉 webapps 目录中的 solr.war

    [root@localhost tomcat]# rm -f webapps/solr.war

    十一、导入相关的 jar 包

    [root@localhost solr-4.10.3]# cp example/lib/ext/* /usr/local/solr/tomcat/webapps/solr/WEB-INF/lib/

     十二、复制 solrhome 到 /usr/local/solr/solrhome

    [root@localhost solr-4.10.3]# cp -r example/solr /usr/local/solr/solrhome

     十三、修改 web.xml

    [root@localhost tomcat]# vim webapps/solr/WEB-INF/web.xml

     

    十四、启动 tomcat

    十五、安装中文分词器

    1、下载中文分词器

      链接:https://pan.baidu.com/s/1_0Bts4BV404zkmEV9LG_1A 密码:coly

    2、进入下载的目录

    [root@localhost 桌面]# cd IK Analyzer 2012FF_hf1/

    3、复制 jar 包到 solr 工程 lib 目录下

    [root@localhost IK Analyzer 2012FF_hf1]# cp IKAnalyzer2012FF_u1.jar /usr/local/solr/tomcat/webapps/solr/WEB-INF/lib/

    4、将配置文件放到 solr 工程的 classpath 下

    (1)创建 classes 目录( 就是 classpath )

    [root@localhost IK Analyzer 2012FF_hf1]# mkdir /usr/local/solr/tomcat/webapps/solr/WEB-INF/classes

    (2)复制 3 个对应的配置文件到 classpath 目录

    [root@localhost IK Analyzer 2012FF_hf1]# cp ext_stopword.dic IKAnalyzer.cfg.xml mydict.dic /usr/local/solr/tomcat/webapps/solr/WEB-INF/classes/

     5、让中文分词器生效

    (1)进入对应的目录

    [root@localhost conf]# cd /usr/local/solr/solrhome/collection1/conf/

    (2)配置一个 FiledType,使用 IKAnalyzer。(复制以下内容到  schema.xml 文件的末尾)

    <fieldType name="text_ik" class="solr.TextField">
      <analyzer class="org.wltea.analyzer.lucene.IKAnalyzer"/>
    </fieldType>

    (3)配置业务域,type 指定使用自定义的 FiledType

    <field name="item_name" type="text_ik" indexed="true" stored="true"/>
    <field name="item_sex" type="text_ik" indexed="true" stored="true"/>
    <field name="item_age"  type="long" indexed="true" stored="true"/>
    <!--复制域:向域中添加数据的时候,会自动把数据添加到复制域上。相当于对搜索的优化-->
    <!--搜索的时候直接搜索 keywords,就包含了 name,sex,age--> 
    <field name="item_keywords" type="text_ik" indexed="true" stored="false" multiValued="true"/>
    <copyField source="item_name" dest="item_keywords"/>
    <copyField source="item_sex" dest="item_keywords"/>
    <copyField source="item_age" dest="item_keywords"/>

     十六、重启 tomcat

  • 相关阅读:
    C#面试题
    C# 安装部署
    Ribbon菜单栏布局和调整大小
    Dev GridControl使用小结
    C#多线程学习(一) 多线程的相关概念
    PDF转换成图片——11种方案
    C#多线程学习(二) 如何操纵一个线程
    C# 截屏方式
    dev中gridview控件
    (转载) 如何降低project压缩文件的大小? (Quartus II)
  • 原文地址:https://www.cnblogs.com/fangwu/p/8647783.html
Copyright © 2011-2022 走看看