elasticsearch 安装和部署

jdk要用1.8以上(elasticsearch版本是1.7.3)

下载elasticsearch的tar包,解压开,更改其名称  mv elasticsearch-5.x.x elasticsearch  则原文件夹的名称就改为elasticsearch了

进入到elasticsearch目录的bin目录  启动服务 ./elasticsearch 如果报filenotexception ,则看缺少什么文件夹,在elasticsearch文

件夹中创建该文件夹即可(不能以root 方式启动该服务)

则还是用非root方式 curl http://localhost:9200{或者http://192.168.40.242:9200/?pretty}(localhost在没有配置elasticsearch.yml的时候服务启动的情况下

这样访问,如果配置了network.host则就是要用该ip进行访问了) ,即可查看是否成功启动

 

安装head插件

安装bigdesk插件

http://192.168.40.242:9200/_plugin/bigdesk/

 使用ik中文切词插件

Elasticsearch默认的中文切词插件是单字切词,这不能满足我们要求,需要安装中文切词插件。

插件github地址:https://github.com/medcl/elasticsearch-analysis-ik
源码安装:编译时需要联网,可以在windows下编译完之后,把elasticsearch-analysis-ik-1.9.3.zip拷贝到linux机器的./plugin/head目录下解压。
配置:在配置文件./config/elasticsearch.yml末尾添加配置: index.analysis.analyzer.ik.type: "ik"

===========================================================================================

我们常见错误:

问题一:警告提示

[2016-11-06T16:27:21,712][WARN ][o.e.b.JNANatives ] unable to install syscall filter: 

java.lang.UnsupportedOperationException: seccomp unavailable: requires kernel 3.5+ with CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER compiled in
at org.elasticsearch.bootstrap.Seccomp.linuxImpl(Seccomp.java:349) ~[elasticsearch-5.0.0.jar:5.0.0]
at org.elasticsearch.bootstrap.Seccomp.init(Seccomp.java:630) ~[elasticsearch-5.0.0.jar:5.0.0]

报了一大串错误,其实只是一个警告。

 解决:使用心得linux版本,就不会出现此类问题了。

问题二:ERROR: bootstrap checks failed

max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
max number of threads [1024] for user [lishang] likely too low, increase to at least [2048]

解决:切换到root用户,编辑limits.conf 添加类似如下内容

vi /etc/security/limits.conf 

添加如下内容:

* hard nofile 131072

* hard nproc 4096

 问题三:max number of threads [1024] for user [lish] likely too low, increase to at least [2048]

解决:切换到root用户,进入limits.d目录下修改配置文件。

vi /etc/security/limits.d/90-nproc.conf 

修改如下内容:

* soft nproc 1024

#修改为

* soft nproc 2048

 问题四:max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]

解决:切换到root用户修改配置sysctl.conf

vi /etc/sysctl.conf 

添加下面配置:

vm.max_map_count=655360

并执行命令:

sysctl -p

然后,重新启动elasticsearch,即可启动成功。