ES启动是产生的报错

  • Post author:
  • Post category:其他




报错一:

ERROR: bootstrap checks failed

解决方案:

vim /etc/security/limits.conf //添加, 【注销后并重新登录生效】

* soft nofile 300000
* hard nofile 300000
* soft nproc 102400
* hard nproc 102400
* hard memlock unlimited
* soft memlock unlimited



报错二:

[2016-12-30T15:18:09,190][WARN ][o.e.b.JNANatives ] Unable to lock JVM Memory: error=12, reason=无法分配内存

[2016-12-30T15:18:09,190][WARN ][o.e.b.JNANatives ] This can result in part of the JVM being swapped out.

[2016-12-30T15:18:09,191][WARN ][o.e.b.JNANatives ] Increase RLIMIT_MEMLOCK, soft limit: 65536, hard limit: 65536

[2016-12-30T15:18:09,191][WARN ][o.e.b.JNANatives ] These can be adjusted by modifying /etc/security/limits.conf, for example:

# allow user 'stt' mlockall

stt soft memlock unlimited

stt hard memlock unlimited

解决方案:

vim /etc/security/limits.conf //添加

* soft memlock unlimited

* hard memlock unlimited



报错三:

max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

解决方案:

vim /etc/sysctl.conf //添加

vm.max_map_count=262144

执行:sysctl -p



报错四:

max number of threads [3818] for user [es] is too low, increase to at least [4096]

解决方案:

最大线程个数太低。修改配置文件/etc/security/limits.conf,增加配置

soft nproc 4096
hard nproc 4096

可通过命令查看

ulimit -Hu

ulimit -Su



报错五:

(这个问题一但成为第一个阻断服务启动的原因,在终端是不会有输出和任何的日志记录的,文章末请听我讲)

Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000094cc0000, 1798569984, 0) failed; error='Cannot allocate memory' (errno=12)

#

# There is insufficient memory for the Java Runtime Environment to continue.

# Native memory allocation (mmap) failed to map 1798569984 bytes for committing reserved memory.

# An error report file with more information is saved as:

# /home/stt/server/elasticsearch-5.1.1/hs_err_pid10221.log

解决方案(最好不要修改默认值,否则引起更多问题):

(内存溢出,思路更改JVM内存大小即可)

vim elasticsearch-5.1.1/config/jvm.options

# Xms represents the initial size of total heap space

# Xmx represents the maximum size of total heap space

 

-Xms1g    (默认为2G)

-Xmx1g    (默认为2G)



2017-01-12T16:12:22,404][INFO ][o.e.b.BootstrapCheck     ] [SfD5sIh] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
ERROR: bootstrap checks failed
initial heap size [536870912] not equal to maximum heap size [1073741824]; this can cause resize pauses and prevents mlockall from locking the entire heap

解决方法:

vi config/jvm.options

###-Xms 和 -Xmx需要配置的相等,不然无法启动成功。

-Xms1024m
-Xmx1024m



报错六:

elasticsearch启动报错Exception java.lang.IllegalStateException: Failed to create node environment

【问题描述】

1、启动elasticsearch后使用systemctl status elasticsearch查看状态异常

2、查看/var/log/elasticsearch下elasticsearch日志报错

elasticsearch启动报错

Exception java.lang.IllegalStateException: Failed to create node environment


在这里插入图片描述

【问题分析】

1、部署elasticsearch后,设置的elasticsearch的data目录为/data/elasticsearch/data

2、由于/data/elasticsearch/data所在磁盘空间只有30g,挂载了另一个路径/es有300g空间,将elasticsearch的data目录从/data/elasticsearch/data切换到/es/data

3、切换后启动elasticsearch报上述错误

4、检查/data/elasticsearch/data目录属主为elasticsearch:elasticsearch

5、检查/es/data目录属主为root:root

在这里插入图片描述

【解决方案】

1、修改/es/data目录属主

chown -R elasticsearch:elasticsearch data

在这里插入图片描述

2、数据恢复

如果需要继续保留/data/elasticsearch/data下的数据,可以将该目录下的数据直接拷贝到/es/data目录下

cp -R /data/elasticsearch/data/nodes /es/data



版权声明:本文为a13568hki原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。