Linux运维

Solr - Centos7 下solr重启core丢失的问题

2016-08-19  本文已影响2034人  菩提老鹰

导语

新手玩solr, 第一次用的solr5.1.0,后来在另外一个环境换成solr5.3.0, 在新的环境中按照之前的方式新增core后重启服务会出现自己新增的core 丢失,但是再次创建同名的core的时候,会提示core已经存在


问题追踪

既然是按照旧的环境方式来新增的,先比较下两个环境的solr

-Xms512m -Xmx512m -XX:NewRatio=3 -XX:SurvivorRatio=4 -XX:TargetSurvivorRatio=90 -
XX:MaxTenuringThreshold=8 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -
XX:ConcGCThreads=4 -XX:ParallelGCThreads=4 -XX:+CMSScavengeBeforeRemark -
XX:PretenureSizeThreshold=64m -XX:+UseCMSInitiatingOccupancyOnly -
XX:CMSInitiatingOccupancyFraction=50 -XX:CMSMaxAbortablePrecleanTime=6000 -
XX:+CMSParallelRemarkEnabled -XX:+ParallelRefProcEnabled -XX:CMSFullGCsBeforeCompaction=1
-XX:CMSTriggerPermRatio=80 -verbose:gc -XX:+PrintHeapAtGC -XX:+PrintGCDetails -
XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -
XX:+PrintGCApplicationStoppedTime -Xloggc:/opt/sol/server/logs/solr_gc.log -Djetty.port=8983 -
DSTOP.PORT=7983 -DSTOP.KEY=solrrocks -Duser.timezone=UTC -
Dsolr.solr.home=/opt/solr/server/solr -Dsolr.install.dir=/opt/solr -jar start.jar -
XX:OnOutOfMemoryError=/opt/solr/bin/oom_solr.sh 8983 /opt/solr/server/logs OPTIONS=default,rewrite
新环境:
solr 11665 1 0 Aug18 ? 00:00:59 /usr/java/default/bin/java -server -Xss256k -
Xms512m -Xmx512m -XX:NewRatio=3 -XX:SurvivorRatio=4 -XX:TargetSurvivorRatio=90 -
XX:MaxTenuringThreshold=8 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -
XX:ConcGCThreads=4 -XX:ParallelGCThreads=4 -XX:+CMSScavengeBeforeRemark -
XX:PretenureSizeThreshold=64m -XX:+UseCMSInitiatingOccupancyOnly -
XX:CMSInitiatingOccupancyFraction=50 -XX:CMSMaxAbortablePrecleanTime=6000 -
XX:+CMSParallelRemarkEnabled -XX:+ParallelRefProcEnabled -verbose:gc -XX:+PrintHeapAtGC -
XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -
XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -
Xloggc:/var/solr/logs/solr_gc.log -Djetty.port=8983 -DSTOP.PORT=7983 -DSTOP.KEY=solrrocks -
Duser.timezone=UTC -Djetty.home=/opt/solr/server -Dsolr.solr.home=/var/solr/data -
Dsolr.install.dir=/opt/solr -Dlog4j.configuration=file:/var/solr/log4j.properties -jar start.jar -
XX:OnOutOfMemoryError=/opt/solr/bin/oom_solr.sh 8983 /var/solr/logs --module=http
root 17506 14110 0 17:51 pts/1 00:00:00 grep --color=auto solr

```

这里发现个不同之处
旧环境:

-Dsolr.solr.home=/opt/solr/server/solr -Dsolr.install.dir=/opt/solr

新环境:

-Dsolr.solr.home=/var/solr/data -Dsolr.install.dir=/opt/solr

-Dsolr.solr.home 这个变量配置不一样,而自己盲目的在新环境中按照旧环境的/opt/solr/server/solr目录去配置新环境core的
这个时候意识到solr安装的时候前后方式不太一样

默认安装:

solr-5.3.0/bin/install_solr_service.sh solr-5.3.0.tar
这种方式  -Dsolr.solr.home=/var/solr/data -Dsolr.install.dir=/opt/solr

solr-5.3.0/bin/install_solr_service.sh solr-5.3.0.tar -d /opt/solr/server/solr -i /opt/solr

-d 是实际的solr core创建存放目录
-i 是solr服务安装目录

结果

原来是在新增core的时候,`instanceDir`目录填写错误导致的。
然后在新环境中用正确的`instanceDir` 去创建,成功,如下所示
solr-5.3.0.png

总结

附加solr的安装说明

[root@i-qvvz99ja software]# solr-5.3.0/bin/install_solr_service.sh --help

ERROR: Specified Solr installation archive --help not found!


Usage: install_solr_service.sh path_to_solr_distribution_archive OPTIONS

  The first argument to the script must be a path to a Solr distribution archive, such as solr-5.0.0.tgz
    (only .tgz or .zip are supported formats for the archive)

  Supported OPTIONS include:

    -d     Directory for live / writable Solr files, such as logs, pid files, and index data; defaults to /var/solr

    -i     Directory to extract the Solr installation archive; defaults to /opt/
             The specified path must exist prior to using this script.

    -p     Port Solr should bind to; default is 8983

    -s     Service name; defaults to solr

    -u     User to own the Solr files and run the Solr process as; defaults to solr
             This script will create the specified user account if it does not exist.

 NOTE: Must be run as the root user
上一篇 下一篇

猜你喜欢

热点阅读