elasticsearch6.2启动失败,出现如下提示:
1、Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c5330000, 986513408, 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 986513408 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /usr/local/elasticsearch/hs_err_pid1675.log
由于elasticsearch6.2默认分配jvm空间大小为1g,我的阿里云服务器内存不够大,修改jvm空间分配
经过查看网友的经验,elasticesearch已经正常启动。
但随后logstash启动又提示Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c5330000, 986513408, 0) failed; error='Cannot allocate memory' (errno=12)
有反复搜索,按照往上的几种说法已经都改过了,服务器也重启了几遍,差点就放弃了,然后就去加内存,后来又想elasticsearch都启动正常了,为什么logstash报elasticsearch的提示了,就想到了,logstash应该也有个这样的控制文件,来控制启动内存和数据交互时的最大内存。
结果找到了,是logstash/conf/jvm.options
同样是修改里面的-Xmx 和-Xms的数值
下面是几个常见错误,也是网友总结的,与大家分享。
2、max number of threads [1024] for user [elasticsearch] is too low, increase to at least [2048]修改 /etc/security/limits.d/90-nproc.conf
* soft nproc 1024
* soft nproc 2048
3、max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
修改/etc/sysctl.conf配置文件,
cat /etc/sysctl.conf | grep vm.max_map_count
vm.max_map_count=262144
如果不存在则添加
echo "vm.max_map_count=262144" >>/etc/sysctl.conf
4、max file descriptors [65535] for elasticsearch process likely too low, increase to at least [65536]
ulimit -n 65536
以下是在5.5.1是踩过的坑
5、启动异常: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,而ES默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。详见 :https://github.com/elastic/elasticsearch/issues/22899
解决方法:在elasticsearch.yml中配置bootstrap.system_call_filter为false,注意要在Memory下面:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
云服务器、云数据库方案、网络安全防护优选
6、logstash使用rpm包安装的时候没有配置init的启动脚本
默认情况使用rpm包安装完logstash之后没有启动脚本。官网给了一个脚本,需要根据不同的系统版本生成对应的启动脚本,而且官网没有给明使用方法,对于新用户来说算是个坑,不过在终端可以查看到脚本的使用帮助# /usr/share/logstash/bin/system-install --help
生成启动脚本,centos6使用sysv参数,centos7使用systemd
# /usr/share/logstash/bin/system-install /etc/logstash/startup.options sysv
Successfully created systemstartup script for Logstash