elasticsearch单机版安装
系统版本:centos6.2,32位
elasticsearch版本:elasticsearch-5.2.2
jdk版本:1.8.0_171
步骤:1、安装jdk,并在/etc/profile文件中加入环境变量
export JAVA_HOME=/usr/local/java/jdk1.8.0_171(jdk安装目录) export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH
2、以非root用户将elasticsearch-5.2.2上传到服务器上,并解压,然后进入到elasticsearch-5.2.2/bin目录中,执行./elasticsearch启动即可(./elasticsearch & 以后台方式启动)。
遇到的问题:
1、Elasticsearch 启动错误 max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解决:
切换到root 修改配置sysctl.conf vim /etc/sysctl.conf 添加 一行 vm.max_map_count=655360 加载系统参数 sysctl -p 切换回安装elasticsearch用户 重新启动elasticsearch
2、max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
解决:#切换到root用户修改 vim /etc/security/limits.conf # 在最后面追加下面内容 *** hard nofile 65536 *** soft nofile 65536 ( *** 是启动ES的用户)
3、max number of threads [1024] for user [itcast] is too low, increase to at least [2048]
解决:同上述2,在limits.conf文件的后面加上 *** soft nproc 2048 *** hard nproc 2048
修改完问题2和3,必须重新登录服务器才有效(不需要重启)。
4、ERROR: bootstrap checks failed system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
原因:这是在因为Centos6不支持SecComp,而ES5.2.2默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。
解决:在elasticsearch.yml中添加配置项:bootstrap.system_call_filter为false: # ----------------------------------- Memory ----------------------------------- bootstrap.memory_lock: false bootstrap.system_call_filter: false 重新启动程序,问题顺利解决!
5、Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error='Cannot allocate memory' (errno=12)
由于elasticsearch5.5默认分配jvm空间大小为2g,修改jvm空间分配 vim ../elasticsearch-5.5.2/config/jvm.options 默认配置 -Xms2g -Xmx2g 改成 -Xms512m -Xmx512m 即可;