安装配置elasticsearch运行启动命令后 Actived
为failed
,看报错信息“There is insufficient memory for the Java Runtime Environment to continue”翻译过来就是“内存不足,Java运行时环境无法继续。”所以在启动服务之前,我们应该对elasticsearch的配置文件参数进行修改,除非你的虚拟机的分配内存很大!
[root@localhost ~]# systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2019-11-04 21:58:09 CST; 16s ago
Docs: http://www.elastic.co
Process: 1593 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet -Edefault.path.logs=${LOG_DIR} -Edefault.path.data=${DATA_DIR} -Edefault.path.conf=${CONF_DIR} (code=exited, status=1/FAILURE)
Process: 1590 ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec (code=exited, status=0/SUCCESS)
Main PID: 1593 (code=exited, status=1/FAILURE)
Nov 04 21:58:08 localhost.localdomain systemd[1]: Started Elasticsearch.
Nov 04 21:58:09 localhost.localdomain elasticsearch[1593]: Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000094cc0000, 1798569...rrno=12)
Nov 04 21:58:09 localhost.localdomain elasticsearch[1593]: #
Nov 04 21:58:09 localhost.localdomain elasticsearch[1593]: # There is insufficient memory for the Java Runtime Environment to continue.
Nov 04 21:58:09 localhost.localdomain elasticsearch[1593]: # Native memory allocation (mmap) failed to map 1798569984 bytes for committing reserved memory.
Nov 04 21:58:09 localhost.localdomain elasticsearch[1593]: # An error report file with more information is saved as:
Nov 04 21:58:09 localhost.localdomain elasticsearch[1593]: # /tmp/hs_err_pid1593.log
Nov 04 21:58:09 localhost.localdomain systemd[1]: elasticsearch.service: main process exited, code=exited, status=1/FAILURE
Nov 04 21:58:09 localhost.localdomain systemd[1]: Unit elasticsearch.service entered failed state.
Nov 04 21:58:09 localhost.localdomain systemd[1]: elasticsearch.service failed.
我找到了原因,之前我在装VM12分配运行内存是2G!而elasticsearch的初始内存就是2G…
我对CentOS
目录下/etc/elasticsearch
的jvm.options
进行参数修改,初始堆和最大堆都改成了512m的内存大小!!
vim /etc/elasticsearch/jvm.options
再次启动elasticsearch服务,启动成功!
☝上述分享来源个人总结,如果分享对您有帮忙,希望您积极转载;如果您有不同的见解,希望您积极留言,让我们一起探讨,您的鼓励将是我前进道路上一份助力,非常感谢!我会不定时更新相关技术动态,同时我也会不断完善自己,提升技术,希望与君同成长同进步!
☞本人博客:https://coding0110lin.blog.csdn.net/ 欢迎转载,一起技术交流吧!