在具有2GB RAM的机器上启动elasticsearch

时间:2017-03-26 16:24:20

标签: elasticsearch heap-memory elasticsearch-5

尝试在具有2GB RAM的SSD计算机上运行elasticsearch时,我仍然遇到以下错误。

elasticsearch[1234] : # There is insufficient memory for the Java Runtime Environment to continue.
elasticsearch[1234] : # Native memory allocation (mmap) failed to map 1973026816 bytes for committing reserved memory.

我修改了使用以下选项修改的默认配置/etc/init.d/elasticsearch

ES_JAVA_OPTS="-Xms1g -Xmx1g"
ES_HEAP_SIZE=1g

我重新启动了elasticsearch,但我仍然遇到同样的错误。

sudo /bin/systemctl restart elasticsearch.service

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

您应该在jvm.options文件中设置Xms和Xmx。 (/etc/elasticsearch/jvm.options)

您也可以使用环境变量(ES_JAVA_OPTS="-Xms1g -Xmx1g"),但是您需要注释掉jvm.options中的设置才能正常工作。

PS:假设5.x,因为你没有指定版本。

相关问题