Centos 7 安装elasticsearch实现中文搜索

本文共有2522个字。 # centos , elasticsearch/ a

资料下载
elasticsearch中文

git clone git://github.com/medcl/elasticsearch-rtf.git -b master --depth 1
cd elasticsearch-rtf-master
#列出可用插件
bin/elasticsearch-plugin list

会列出可用插件,如下:

analysis-icu
analysis-ik
analysis-kuromoji
analysis-mmseg
analysis-phonetic
analysis-pinyin
analysis-smartcn
analysis-stconvert
analysis-stempel
analysis-ukrainian
discovery-azure-classic
discovery-ec2
discovery-file
discovery-gce
elasticsearch-sql
ingest-attachment
ingest-geoip
ingest-user-agent
lang-javascript
lang-python
mapper-attachments
mapper-murmur3
mapper-size
repository-azure
repository-gcs
repository-hdfs
repository-s3
store-smb

但是我们只用到analysis-ik,所以需要删除其它的插件,不然消耗的内存会比较大

#将插件目录写入文件
bin/elasticsearch-plugin list > /tmp/plugin.log
vim /tmp/plugin.log
#删除analysis-ik

下面删除插件

cat /tmp/plugin.log|xargs -I {} bin/elasticsearch-plugin remove {}

再次查询看是否删除成功

bin/elasticsearch-plugin list
analysis-ik

修改内存使用空间

vim config/jvm.options
-Xms2g
-Xmx2g
# 修改为
-Xms512m
-Xmx512m

启动elasticsearch,注意启动不能使用root账号操作

bin/elasticsearch -d

查看是否启动成功

[root@lnmp elasticsearch-rtf-master]# ps aux|grep java
vagrant   5081  9.9 80.1 2476240 400380 pts/0  Sl   20:53   0:04 /usr/src/jdk1.8.0_171/bin/java -Xms512m -Xmx512m -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/home/wwwroot/DhtServerApi/elasticsearch-rtf-master -cp /home/wwwroot/DhtServerApi/elasticsearch-rtf-master/lib/elasticsearch-5.1.1.jar:/home/wwwroot/DhtServerApi/elasticsearch-rtf-master/lib/* org.elasticsearch.bootstrap.Elasticsearch -d
root      5117  0.0  0.1   9092   668 pts/0    S+   20:53   0:00 grep --color=auto java

或者可以查看日志文件vim logs/elasticsearch.log

版权声明:本文为作者原创,如需转载须联系作者本人同意,未经作者本人同意不得擅自转载。本站微信公众号:7TEC,敬请关注!

暂时无法评论哦~

暂无评论