Elasticsearch内存问题

当我试着在我的Ubuntu中启动elasticsearch时,启动脚本给我提供了以下错误:

Java HotSpot(TM) Client VM warning: INFO: os::commit_memory(0x74800000, 201326592, 0) failed; error='Cannot allocate memory' (errno=12) # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (malloc) failed to allocate 201326592 bytes for committing reserved memory. 

我尝试已经search这个,我找不到解决scheme。 如果我重新启动机器,一切运作良好,然后弹性search下降,出现这个错误。

我已经在elasticsearch.yml文件中设置了属性bootstrap.mlockall:true,以及默认的elasticsearch文件中的属性:

 ES_HEAP_SIZE=512 (I have 1GB of RAM) MAX_LOCKED_MEMORY=unlimited 

有人知道我需要做什么?

谢谢

您已经配置了1 GB RAM的虚拟机,但弹性尝试启动2 GB的RAM(默认为Elasticsearch版本5.X)

为VM提供更多内存,或者更改Elasticsearch JVM设置 /etc/elasticsearch/jvm.options并降低以下参数的值: -Xms512m -Xmx512m

对于当前版本的弹性(5.X),您可以在通常位于/etc/elasticsearch/jvm.options目录下的jvm.options文件中配置jvm启动选项 :

 -Xms1g -Xmx1g 

希望能帮助到你。

您需要通过以下参数启动./bin/elasticsearch -Xmx512m -Xms512./bin/elasticsearch -Xmx512m -Xms512 / ./bin/elasticsearch -Xmx512m -Xms512

不过看起来你的内存(1G)对于运行elasticsearch来说太低了。