Linux环境之solr-7.7.0的搭建配置

==----------------------------------------------------------------------------------------------------------------------
-----== LINUX solr的搭建配置  【成功!!!】

卷首语:solr的安装要依赖JDK或者Tomcat,所以,安装之前,一定要择其一先安装,否则,无法运行!这里选择安装JDK!

软件:jdk-8u201-linux-x64.rpm   solr-7.7.0
目录:/fitness/software/
    ->solr-7.7.0             # solr文件
    ->jdk-8u201-linux-x64    # jdk文件

参考:
    https://www.cnblogs.com/caleyun/articles/10451856.html
    https://www.cnblogs.com/caleyun/articles/10455136.html

1、解压JDK文件
    cd /fitness/software/jdk-8u201-linux-x64
    yum install zip
    yum install unzip
    unzip jdk-8u201-linux-x64.zip

    [root@iZ8vb2eoeg5ij7bvsu4pnxZ jdk-8u201-linux-x64]# ls
    jdk-8u201-linux-x64.rpm  jdk-8u201-linux-x64.zip

2、安装JDK
    rpm -ivh jdk-8u201-linux-x64.rpm

    [root@iZ8vb2eoeg5ij7bvsu4pnxZ jdk-8u201-linux-x64]# rpm -ivh jdk-8u201-linux-x64.rpm
    warning: jdk-8u201-linux-x64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
    Preparing...                          ################################# [100%]
    Updating / installing...
       1:jdk1.8-2000:1.8.0_201-fcs        ################################# [100%]
    Unpacking JAR files...
       tools.jar...
       plugin.jar...
       javaws.jar...
       deploy.jar...
       rt.jar...
       jsse.jar...
       charsets.jar...
       localedata.jar...

    感觉有点问题,按文档sudo一下, sudo rpm -ivh jdk-8u201-linux-x64.rpm

    [root@iZ8vb2eoeg5ij7bvsu4pnxZ jdk-8u201-linux-x64]# sudo rpm -ivh jdk-8u201-linux-x64.rpm
    warning: jdk-8u201-linux-x64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
    Preparing...                          ################################# [100%]
       package jdk1.8-2000:1.8.0_201-fcs.x86_64 is already installed

    感觉好像安装成功了!

3、jdk安装成功后,默认存放在/usr/java文件目录中。

   查看一下:
   [root@iZ8vb2eoeg5ij7bvsu4pnxZ jdk-8u201-linux-x64]# cd /usr/java/
   [root@iZ8vb2eoeg5ij7bvsu4pnxZ java]# ls
   default  jdk1.8.0_201-amd64  latest

    看到了!jdk1.8.0_201-amd64,就是它!

4、JDK配置环境变量

    编辑:
    vim /etc/profile

    在文件的尾部添加如下命令:
    export JAVA_HOME=/usr/java/jdk1.8.0_201-amd64
    export PATH=$PATH:$JAVA_HOME/bin
    export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tool.jar

    生效环境变量:
    source /etc/profile

    验证环境变量是否生效:
    echo $PATH

    [root@iZ8vb2eoeg5ij7bvsu4pnxZ java]# echo $PATH
    /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/java/jdk1.8.0_201-amd64/bin

5、JDK的rpm包,你可保留,也可删除,随意
    rm -rf jdk-8u201-linux-x64.rpm

6、下载solr-7.7.0资源包,上传到/fitness/software/solr-7.7.0目录
    加压:tar zxvf solr-7.7.0.tgz

    [root@iZ8vb2eoeg5ij7bvsu4pnxZ solr-7.7.0]# ls
    solr-7.7.0  solr-7.7.0.tgz

7、将solr-7.7.0复制到安装目录
    cp -r /fitness/software/solr-7.7.0/solr-7.7.0/* /fitness/serve/solr-7.7.0

    119:
    bin  CHANGES.txt  contrib  dist  docs  example  licenses  LICENSE.txt  LUCENE_CHANGES.txt  NOTICE.txt  README.txt  server

    164:
    bin  CHANGES.txt  contrib  dist  docs  example  licenses  LICENSE.txt  LUCENE_CHANGES.txt  NOTICE.txt  README.txt  server

8、启动solr
    cd /fitness/serve/solr-7.7.0/bin/
    ./solr start

    有警告:
    [root@iZ8vb2eoeg5ij7bvsu4pnxZ bin]# ./solr start
    *** [WARN] ***  Your Max Processes Limit is currently 63458.
     It should be set to 65000 to avoid operational disruption.
     If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
    WARNING: Starting Solr as the root user is a security risk and not considered best practice. Exiting.
             Please consult the Reference Guide. To override this check, start with argument '-force'


    加个参数 -force 看看
    [root@iZ8vb2eoeg5ij7bvsu4pnxZ bin]# ./solr start -force
    *** [WARN] ***  Your Max Processes Limit is currently 63458.
     It should be set to 65000 to avoid operational disruption.
     If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
    NOTE: Please install lsof as this script needs it to determine if Solr is listening on port 8983.

    Started Solr server on port 8983 (pid=19657). Happy searching!

    一般看到【 Happy searching!】就表示solr已经启动

    查看一下状态:./solr status
    [root@iZ8vb2eoeg5ij7bvsu4pnxZ bin]# ./solr status

    Found 1 Solr nodes:

    Solr process 19657 running on port 8983
    INFO  - 2019-06-20 17:38:31.499; org.apache.solr.util.configuration.SSLCredentialProviderFactory; Processing SSL Credential Provider chain: env;sysprop
    {
      "solr_home":"/fitness/serve/solr-7.7.0/server/solr",
      "version":"7.7.0 8c831daf4eb41153c25ddb152501ab5bae3ea3d5 - jimczi - 2019-02-04 23:23:46",
      "startTime":"2019-06-20T09:37:01.106Z",
      "uptime":"0 days, 0 hours, 1 minutes, 30 seconds",
      "memory":"34.8 MB (%7.1) of 490.7 MB"
    }

    由上我们能够看出solr的内存只有490.7 MB,有点小,需重新指定

9、指定solr内存
    ./solr restart -m 4g

    [root@iZ8vb2eoeg5ij7bvsu4pnxZ bin]# ./solr restart -m 4g
    *** [WARN] ***  Your Max Processes Limit is currently 63458.
     It should be set to 65000 to avoid operational disruption.
     If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
    WARNING: Starting Solr as the root user is a security risk and not considered best practice. Exiting.
             Please consult the Reference Guide. To override this check, start with argument '-force'
    [root@iZ8vb2eoeg5ij7bvsu4pnxZ bin]# ./solr restart -m 4g -force
    *** [WARN] ***  Your Max Processes Limit is currently 63458.
     It should be set to 65000 to avoid operational disruption.
     If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
    Sending stop command to Solr running on port 8983 ... waiting up to 180 seconds to allow Jetty process 20286 to stop gracefully.
    NOTE: Please install lsof as this script needs it to determine if Solr is listening on port 8983.

    Started Solr server on port 8983 (pid=20614). Happy searching!

    这里,我们发现【NOTE: Please install lsof as this script needs it to determine if Solr is listening on port 8983.】,意思是:
    注意:请安装lsof,因为此脚本需要它来确定solr是否在监听端口8983。

    sudo yum install lsof

    安装即可!
    lsof(list open files)代表列出一些列打开的文件。在Unix系统中,每一个东西都是一个文件(管道,套接字,目录,设备等)。这样的话,你可以
    通过lsof命名列出所有打开的文件。

    lsof 仅列出一些列属于激活进程的大文件。
    lsof /fitness 列出那些打开一个具体文件的进程
    lsof +D /var/log  列出一个目录下的进程
    lsof -c ssh -c init  以进程名称为开始字符的进程
    lsof -u app  指定具体的某个用户的进程

    kill -9 `lsof -t -u app`  kill属于某个用户的进程
    lsof -i 列出所有的网络链接
    lsof -i -a -p 2038 通过具体进程列出正在使用的网路文件
    lsof -i :25  监听具体端口的进程
    lsof -i tcp; lsof -i udp 列出所有TCP和UDP连接
    lsof -N -u app -a  列出所有的网络文件系统的文件

    查看虚拟内存的大小是否指定:
    [root@iZ8vb2eoeg5ij7bvsu4pnxZ bin]# ./solr status

    Found 1 Solr nodes:

    Solr process 20614 running on port 8983
    INFO  - 2019-06-20 17:48:21.384; org.apache.solr.util.configuration.SSLCredentialProviderFactory; Processing SSL Credential Provider chain: env;sysprop
    {
      "solr_home":"/fitness/serve/solr-7.7.0/server/solr",
      "version":"7.7.0 8c831daf4eb41153c25ddb152501ab5bae3ea3d5 - jimczi - 2019-02-04 23:23:46",
      "startTime":"2019-06-20T09:44:57.229Z",
      "uptime":"0 days, 0 hours, 3 minutes, 24 seconds",
      "memory":"196.3 MB (%5) of 3.8 GB"
    }

    已经改过来了 【3.8G】
    【注意:重启的时候,如果不指定虚拟内存,那么内存大小将恢复到未指定前!切记!】

10、查看8983端口是否被占用
    netstat -anp | grep 8983

    [root@iZ8vb2eoeg5ij7bvsu4pnxZ bin]#  netstat -anp | grep 8983
    tcp        0      0 0.0.0.0:8983            0.0.0.0:*               LISTEN      20614/java

    这里显示的是被java占用了,刚才安装了jdk,这个貌似是跟java有关!查看已经安装好的服务器:
    [root@fit-server /]# netstat -anp | grep 8983
    tcp        0      0 0.0.0.0:8983            0.0.0.0:*               LISTEN      4778/java
    tcp        0      0 172.26.1.13:56644       172.26.1.13:8983        TIME_WAIT   -
    tcp        0      0 172.26.1.13:56672       172.26.1.13:8983        TIME_WAIT   -
    tcp        0      0 172.26.1.13:56636       172.26.1.13:8983        TIME_WAIT   -
    tcp        0      0 172.26.1.13:56770       172.26.1.13:8983        TIME_WAIT   -
    tcp        0      0 172.26.1.13:56890       172.26.1.13:8983        TIME_WAIT   -
    tcp        0      0 172.26.1.13:56470       172.26.1.13:8983        TIME_WAIT   -
    tcp        0      0 172.26.1.13:57386       172.26.1.13:8983        TIME_WAIT   -
    tcp        0      0 172.26.1.13:57382       172.26.1.13:8983        TIME_WAIT   -
    tcp        0      0 172.26.1.13:57380       172.26.1.13:8983        TIME_WAIT   -
    tcp        0      0 172.26.1.13:56722       172.26.1.13:8983        TIME_WAIT   -

    应该是对的!

11、阿里云控制台,添加白名单,访问控制台

    http://66.190.675.4:8983/solr/#/

    直接访问,居然看到了控制台的界面,但是,我还没加白名单啊!为什么?

    其实,之前的ces服务器和当前正在安装的这台服务器的属于同一个【安全组】,添加一次,就可以了,所以,当前ecs服务器是不用再添加白名单了!
    故而,能访问!!!


12、可以访问控制台,那我们就要给solr导入数据了,这里需要一些文件,这些文件的主要作用就是,连接数据库,将数据库的数据导入到solr,就好比是一个
桥梁,不然平白无故,怎么就从mysql到solr了?!
    这些文件很重要!

    那在哪里呢?在这里:
    /fitness/serve/solr-7.7.0/server/solr-webapp/webapp/WEB-INF/lib/
    [root@iZ8vb2eoeg5ij7bvsu4pnxZ lib]# ls
    antlr4-runtime-4.5.1-1.jar     commons-fileupload-1.3.3.jar    hadoop-auth-2.7.4.jar               jackson-mapper-asl-1.9.13.jar        lucene-highlighter-7.7.0.jar       protobuf-java-3.1.0.jar
    asm-5.1.jar                    commons-io-2.5.jar              hadoop-common-2.7.4.jar             janino-2.7.6.jar                     lucene-join-7.7.0.jar              rrd4j-3.2.jar
    asm-commons-5.1.jar            commons-lang-2.6.jar            hadoop-hdfs-2.7.4.jar               joda-time-2.2.jar                    lucene-memory-7.7.0.jar            solr-core-7.7.0.jar
    avatica-core-1.10.0.jar        commons-lang3-3.6.jar           hppc-0.8.1.jar                      lucene-analyzers-common-7.7.0.jar    lucene-misc-7.7.0.jar              solr-solrj-7.7.0.jar
    caffeine-2.4.0.jar             commons-math3-3.6.1.jar         htrace-core-3.2.0-incubating.jar    lucene-analyzers-kuromoji-7.7.0.jar  lucene-queries-7.7.0.jar           spatial4j-0.7.jar
    calcite-core-1.13.0.jar        curator-client-2.8.0.jar        httpclient-4.5.6.jar                lucene-analyzers-nori-7.7.0.jar      lucene-queryparser-7.7.0.jar       stax2-api-3.1.4.jar
    calcite-linq4j-1.13.0.jar      curator-framework-2.8.0.jar     httpcore-4.4.10.jar                 lucene-analyzers-phonetic-7.7.0.jar  lucene-sandbox-7.7.0.jar           t-digest-3.1.jar
    commons-cli-1.2.jar            curator-recipes-2.8.0.jar       httpmime-4.5.6.jar                  lucene-backward-codecs-7.7.0.jar     lucene-spatial3d-7.7.0.jar         woodstox-core-asl-4.4.1.jar
    commons-codec-1.11.jar         disruptor-3.4.0.jar             jackson-annotations-2.9.6.jar       lucene-classification-7.7.0.jar      lucene-spatial-extras-7.7.0.jar    zookeeper-3.4.13.jar
    commons-collections-3.2.2.jar  dom4j-1.6.1.jar                 jackson-core-2.9.6.jar              lucene-codecs-7.7.0.jar              lucene-suggest-7.7.0.jar
    commons-compiler-2.7.6.jar     eigenbase-properties-1.1.5.jar  jackson-core-asl-1.9.13.jar         lucene-core-7.7.0.jar                noggit-0.8.jar
    commons-configuration-1.6.jar  guava-14.0.1.jar                jackson-databind-2.9.6.jar          lucene-expressions-7.7.0.jar         org.restlet-2.3.0.jar
    commons-exec-1.3.jar           hadoop-annotations-2.7.4.jar    jackson-dataformat-smile-2.9.6.jar  lucene-grouping-7.7.0.jar            org.restlet.ext.servlet-2.3.0.jar

    这里放的就是jar包!

    那光有这些jar包,还是不够的,我们还要需要一部分jar包,哪些呢?
    /fitness/serve/solr-7.7.0/dist/
    [root@iZ8vb2eoeg5ij7bvsu4pnxZ dist]# ls
    solr-analysis-extras-7.7.0.jar  solr-clustering-7.7.0.jar         solr-dataimporthandler-extras-7.7.0.jar  solr-ltr-7.7.0.jar                  solr-test-framework-7.7.0.jar
    solr-analytics-7.7.0.jar        solr-core-7.7.0.jar               solrj-lib                                solr-prometheus-exporter-7.7.0.jar  solr-velocity-7.7.0.jar
    solr-cell-7.7.0.jar             solr-dataimporthandler-7.7.0.jar  solr-langid-7.7.0.jar                    solr-solrj-7.7.0.jar                test-framework

    也就是说,我们还需要把这里的jar包复制到/fitness/serve/solr-7.7.0/server/solr-webapp/webapp/WEB-INF/lib/目录下
    命令如下:
    cp /fitness/serve/solr-7.7.0/dist/solr-dataimporthandler-extras-7.7.0.jar  /fitness/serve/solr-7.7.0/server/solr-webapp/webapp/WEB-INF/lib/
    cp /fitness/serve/solr-7.7.0/dist/solr-dataimporthandler-7.7.0.jar  /fitness/serve/solr-7.7.0/server/solr-webapp/webapp/WEB-INF/lib/

    还有一个jar包,用来连接mysql的,名字叫:mysql-connector-java-8.0.15.jar,这个jar包需要下载,下载完,放入到:
    fitness/serve/solr-7.7.0/server/solr-webapp/webapp/WEB-INF/lib/目录下,就可以了!


    【注意:导入jar包的时候,solr要停止!!!!也就是说,你如果没停止solr,新加jar包后,得重启solr】

13、到这里,我们就可以进行数据库的数据,导入到solr的操作了,具体如下。

    solr创建core并导入数据
    --------------------------------------------------------------------------------------------------------------------
    1)、进入到/data1/fitsrv/solr-7.7.0/bin目录下,执行:./solr create -c coach-solr , 创建coach-solr项目, 如果命令无法执行,进入控制台
        a、浏览器进入到控制台,Core Admin, Add Core, 输入
            name:coach-solr | instanceDir:coach-solr | dataDir:data | config:solr-config.xml | schema:managed-schema
        b、点击Add Core。可能会报如下错误
            Error CREATEing SolrCore 'coach-solr': Unable to create core [coach-solr] Caused by: Can't find resource 'solrconfig.xml' in classpath or '/data1/fitsrv/solr-7.7.0/server/solr/coach-solr'
        c、执行以下命令,复制核心配置文件
            cp -r /fitness/serve/solr-7.7.0/server/solr/configsets/_default/conf/ /fitness/serve/solr-7.7.0/server/solr/coach-solr/
        d、再次去到控制台,点击Add Core
        e、创建成功,success!
    2)、进入到coach-solr/conf目录下,创建data-config.xml文件
    3)、vim data-config.xml (连接mysql,进行数据导入)
    4)、将下列文件粘贴入 data-config.xml文件:
    <?xml version="1.0" encoding="UTF-8"?>
    <dataConfig>
        <dataSource name="source" type="JdbcDataSource"
                  driver="com.mysql.jdbc.Driver"
                  url="jdbc:mysql://rm-8sdfehj1bo.mysql.rew.erewqq.com:3306/ness?serverTimezone=UTC&amp;tinyInt1isBit=false"
                  user="8888"
                  password="8888"
                  batchSize="0"
                  />
        <document>
            <entity name="coach" dataSource="source" pk="id"
                query="SELECT `id`, `name`, `head_img`, `certificate`, `height`, `weight`, `gender`, `mobile`, `birthday`, `native_place`, `staff_card_no`, `work_date`, `score`, `status`, `is_have_course`, `cityid`, `gym_id`, `profile`, `profile_img`, `is_take_order`, `weekly_course_num`, `area_province`, `area_city`, `area_district`, `area_street`, `top`, `longitude`, `latitude`,  CONCAT(`latitude`, ',', `longitude`) AS location, `createtime`, `updatetime`, `day_course_num` FROM `coach` "
                deltaImportQuery="SELECT `id`, `name`, `head_img`, `certificate`, `height`, `weight`, `gender`, `mobile`, `birthday`, `native_place`, `staff_card_no`, `work_date`, `score`, `status`, `is_have_course`, `cityid`, `gym_id`, `profile`, `profile_img`, `is_take_order`, `weekly_course_num`, `area_province`, `area_city`, `area_district`, `area_street`, `top`, `longitude`, `latitude`,  CONCAT(`latitude`, ',', `longitude`) AS location, `createtime`, `updatetime`, `day_course_num` FROM `coach` where id = '${dataimporter.delta.id}'"
                deltaQuery="select id from coach where updatetime > '${dataimporter.last_index_time}'" >
                <field column="id" name="id" />
                <field column="name" name="name" />
                <field column="head_img" name="head_img" />
                <field column="certificate" name="certificate" />
                <field column="height" name="height" />
                <field column="weight" name="weight" />
                <field column="gender" name="gender" />
                <field column="mobile" name="mobile" />
                <field column="birthday" name="birthday" />
                <field column="native_place" name="native_place" />
                <field column="staff_card_no" name="staff_card_no" />
                <field column="work_date" name="work_date" />
                <field column="score" name="score" />
                <field column="status" name="status" />
                <field column="is_have_course" name="is_have_course" />
                <field column="cityid" name="cityid " />
                <field column="gym_id" name="gym_id" />
                <field column="profile" name="profile" />
                <field column="profile_img" name="profile_img" />
                <field column="is_take_order" name="is_take_order" />
                <field column="weekly_course_num" name="weekly_course_num" />
                <field column="area_province" name="area_province" />
                <field column="area_city" name="area_city" />
                <field column="area_district" name="area_district" />
                <field column="area_street" name="area_street" />
                <field column="top" name="top" />
                <field column="longitude" name="longitude" />
                <field column="latitude" name="latitude" />
                <field column="location" name="location" />
                <field column="createtime" name="createtime" />
                <field column="updatetime" name="updatetime" />
                <field column="day_course_num"  name="day_course_num" />
            </entity>
        </document>
    </dataConfig>
    5)、你得告诉solr你写的这个文件,所以,编辑fit-coach/conf/solr-config.xml,加入以下内容:
        <initParams path="/update/**,/query,/select,/tvrh,/elevate,/spell,/browse">
            <lst name="defaults">
              <str name="df">_text_</str>
            </lst>
        </initParams>

        这段代码前,加入以下代码:
       <requestHandler name="/dataimport"  class="org.apache.solr.handler.dataimport.DataImportHandler">
          <lst name="defaults">
              <str name="config">data-config.xml</str>
          </lst>
      </requestHandler>
    6)、solr基于索引搜索,我们还得配置索引,编辑fit-coach/conf/manage-schema文件,查找field,位置大概在


        <field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
        <!--这里添加新的索引-->

            <field name="name"       type="text_like" indexed="true"  stored="true" />
            <field name="head_img"   type="string"    indexed="false" stored="true" />
            <field name="gender"     type="pint"   indexed="true"  stored="true" />
            <field name="mobile"     type="string"    indexed="true"  stored="true" />
            <field name="score"      type="pint"   indexed="true"  stored="true" />
            <field name="status"     type="pint"   indexed="true"  stored="true" />
            <field name="is_have_course"  type="pint"      indexed="true"  stored="true" />
            <field name="cityid"     type="pint"      indexed="true"  stored="true" />
            <field name="gym_id"     type="pint"      indexed="true"  stored="true" />
            <field name="is_take_order"   type="pint"      indexed="true"  stored="true" />
            <field name="area_province"   type="pint"      indexed="true"  stored="true" />
            <field name="area_city"   type="pint"      indexed="true"  stored="true" />
            <field name="area_district"   type="pint"      indexed="true"  stored="true" />
            <field name="area_street"   type="pint"      indexed="true"  stored="true" />

            <field name="createtime" type="pdate"     indexed="true"  stored="true" />
            <field name="updatetime" type="pdate"     indexed="true"  stored="true" />

            <field name="latitude"   type="string"    indexed="false" stored="true" />
            <field name="location"   type="location"  indexed="true"  stored="true" />

        <!-- docValues are enabled by default for long type so we don't need to index the version field  -->
        <field name="_version_" type="plong" indexed="false" stored="false"/>
        <field name="_root_" type="string" indexed="true" stored="false" docValues="false" />
        <field name="_text_" type="text_general" in dexed="true" stored="false" multiValued="true"/>

    6.2)、在course-solr/conf目录下创建 dataimport.properties 文件,非目录
        touch dataimport.properties
        chmod 666 dataimport.properties
    7)、重新启动solr
        /etc/init.d/solr restart
    8)、回到控制台,浏览器访问,http://47.92.66.119:8983/solr/index.html#/,Core Select, 选择fit-coach, data-import, 选择coach,
    最后执行excute
    9)、搞定!
    --------------------------------------------------------------------------------------------------------------------

14、彩蛋
    如果你用的是阿里云【云数据库RDS版】,切记去控制台,给你安装的solr所在的ECS服务器ip,加个白名单!!!
    否则,你的数据,永远import不成功!!ever is 0 process!

    果然成功!!!

    Last Update: 19:12:38
    Indexing completed. Added/Updated: 2788 documents. Deleted 0 documents. (Duration: 04s)
    Requests: 2,789 697/s, Fetched: 5,738 1,435/s, Skipped: 0 , Processed: 2,788 697/s
    Started: about a minute ago

    cp -r /fitness/serve/solr-7.7.0/server/solr/configsets/_default/conf/ /fitness/serve/solr-7.7.0/server/solr/course-solr/

    /fitness/serve/solr-7.7.0/bin/solr restart -m 4g -force
    /fitness/serve/solr-7.7.0/bin/solr status

15、驱动问题
    Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'.
    The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

    cp ./mysql-connector-java-5.0.6-bin.jar /usr/java/jdk1.8.0_201-amd64/lib
    cp ./mysql-connector-java-5.0.6-bin.jar /fitness/serve/solr-7.7.0/server/solr-webapp/webapp/WEB-INF/lib


    Jun 19, 2019 7:42:11 PM com.chenlb.mmseg4j.Dictionary getInstance
    INFO: try to load dir=/data1/fitnesssrv/solr-7.7.0/server/solr/badwords/conf
    Jun 19, 2019 7:42:11 PM com.chenlb.mmseg4j.Dictionary loadDic
    INFO: chars loaded time=15ms, line=12638, on file=file:/data1/fitsrv/solr-7.7.0/server/solr-webapp/webapp/WEB-INF/lib/mmseg4j-core-1.10.0.jar!/data/chars.dic
    Jun 19, 2019 7:42:11 PM com.chenlb.mmseg4j.Dictionary loadWord
    INFO: words loaded time=127ms, line=149853, on file=file:/data1/fitsrv/solr-7.7.0/server/solr-webapp/webapp/WEB-INF/lib/mmseg4j-core-1.10.0.jar!/data/words.dic
    Jun 19, 2019 7:42:11 PM com.chenlb.mmseg4j.Dictionary loadDic
    INFO: load all dic use time=144ms
    Jun 19, 2019 7:42:11 PM com.chenlb.mmseg4j.Dictionary loadUnit
    INFO: unit loaded time=0ms, line=22, on file=file:/data1/fitsrv/solr-7.7.0/server/solr-webapp/webapp/WEB-INF/lib/mmseg4j-core-1.10.0.jar!/data/units.dic
    Jun 19, 2019 7:42:11 PM com.chenlb.mmseg4j.Dictionary getInstance
    INFO: try to load dir=/data1/fitnesssrv/solr-7.7.0/server/solr/badwords/conf
    Jun 19, 2019 7:42:11 PM com.chenlb.mmseg4j.Dictionary getInstance
    INFO: try to load dir=/data1/fitnesssrv/solr-7.7.0/server/solr/badwords/conf
    Jun 19, 2019 7:42:11 PM com.chenlb.mmseg4j.Dictionary getInstance
    INFO: try to load dir=/data1/fitnesssrv/solr-7.7.0/server/solr/badwords/conf
    Jun 19, 2019 7:42:11 PM com.chenlb.mmseg4j.Dictionary getInstance
    INFO: try to load dir=/data1/fitnesssrv/solr-7.7.0/server/solr/badwords/conf
    Jun 19, 2019 7:42:11 PM com.chenlb.mmseg4j.Dictionary getInstance
    INFO: try to load dir=/data1/fitnesssrv/solr-7.7.0/server/solr/badwords/conf
    Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

    // 查询驱动配置的位置
    grep -rn "<artifactId>mysql-connector-java</artifactId>" *
    grep -rn "mysql-connector-java<" *
    grep -rn "8.0.15" *
    grep -rn "com.mysql.cj.jdbc.Driver" *

    思路文档:
    https://blog.csdn.net/qq_40213244/article/details/82964802


    忽略大小写:
    编辑managed-schema文件:
    下面这段放这个标签</schema>的里面
    <fieldType name="str_lower" class="solr.TextField" sortMissingLast="true" omitNorms="true">
         <analyzer>
            <tokenizer class="solr.KeywordTokenizerFactory"/>
            <filter class="solr.LowerCaseFilterFactory" />
         </analyzer>
    </fieldType>
    然后,将要使用的索引字段的类型定义为str_lower
    <field name="name"  type="str_lower"  indexed="true"  stored="true" />
    最后,重启solr,重新导入数据即可

----------------------------------------------------------------------------------------------------------------------==
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值