注:以下内容基于CentOS Linux release 7.5.1804,elasticsearch 6.5.4
1.org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
原因:不能用root账户启动
解决方法:创建普通用户,并授权es整个文件夹的执行权限给创建的用户,使用创建的用户启动。
2.java.nio.file.AccessDeniedException: /data/wwwroot/elasticsearch-x.x.x/config/jvm.options
原因:当前用户没有执行权限
解决方法:授权es整个文件夹的执行权限给启动的用户。
3.max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
原因:一个进程可以拥有的VMA(虚拟内存区域)的数量太小
解决方法:执行sysctl -w vm.max_map_count=262144
,如果没有权限,使用root账户执行。
4.max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
原因:最大文件描述符(max file descriptors)过小
解决办法:vim /etc/security/limits.conf,添加如下内容:
elasticsearcch soft nofile 65536
elasticsearcch hard nofile 131072
注意:1.修改后需要重新登录。
2.第一列为用户名,尽量不要使用*,不然多用户使用,有没有断开的,容易造成重新登录不刷新ulimit值,修改不起作用。修改后可以用以下命令检查:
ulimit -Hn
ulimit -Sn
5.max number of threads [2048] for user [elasticsearch] is too low, increase to at least [4096]
原因:elasticsearch用户的最大线程数太低
解决办法:vim /etc/security/limits.conf,添加如下内容:
elasticsearcch soft nproc 4096
elasticsearcch hard nproc 4096
注意:登录用户断开重连。