Centos的ES配置

启动es失败,java版本太低

[root@lepard elasticsearch]# service elasticsearch start
正在启动 elasticsearch:Elasticsearch requires at least Java 8 but your Java 
version from /usr/bin/java does not meet this requirement

升级java8

yum update
前往[Oracle Java下载页面](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
下载jdk-8u131-linux-x64.rpm
rpm -ivh jdk-8u131-linux-x64.rpm
java -version
配置JAVA环境变量参考 http://www.jianshu.com/p/848b06dd19aa

root用户启动失败

org.elasticsearch.bootstrap.StartupException: 
java.lang.RuntimeException: can not run elasticsearch as root
groupadd elasticsearch
useradd elasticsearch -g elasticsearch -p elasticsearch
//改密码
passwd elasticsearch

su elasticsearch

This account is currently not available.
[root@lepard ~]# cat /etc/passwd | grep elasticsearch
elasticsearch:x:494:491:elasticsearch user:/home/elasticsearch:/sbin/nologin
发现它的shell是“/sbin /nologin”,需要将起改成“/bin/bash”

ES启动失败-vm.max_map_count [65530] is too low

ERROR: bootstrap checks failed
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解决办法:
The vm_map_max_count setting should be set permanently in /etc/sysctl.conf:
$ grep vm.max_map_count /etc/sysctl.conf
vm.max_map_count=262144

To apply the setting on a live system type:

sysctl -w vm.max_map_count=262144

ES启动失败-max file

max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
vim /etc/security/limits.conf 
* soft nofile 65536
* hard nofile 65536
vim /etc/security/limits.d/90-nproc.conf 
*          soft    nproc     102400
root       soft    nproc     unlimited

ES启动失败-max number of threads

bootstrap checks failed
max number of threads [1024] for user [elasticsearch] is too low, increase to at least [2048]
cd /etc/security/limits.d
vi 90-nproc.conf
*          soft    nproc     102400

ES启动失败-system_call_filter

failed to install; check the logs and fix your configuration or disable 
system call filters at your own risk 
在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
参考 http://www.jianshu.com/p/89f8099a6d09

ES启动失败-node locks

问题:Caused by: java.lang.IllegalStateException: failed to obtain node locks, tried [[/var/lib/elasticsearch/elasticsearch]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing 
解决办法:chown -R elasticsearch /var/lib/elasticsearch/

在本机http://localhost:9200/?pretty可以访问,http://10.2.3.4:9200/?pretty不能访问

首先打开防火墙
-A INPUT -p tcp -m tcp --dport 9200 -j ACCEPT
其次修改es配置文件network.host
cd /etc/elasticsearch/
vi elasticsearch.yml 
添加ip
network.host: 10.2.3.4
http.port: 9200
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容