Docker 启动elasticsearch限制使用内存

Published on Aug. 22, 2023, 12:09 p.m.

Reducing Memory#

只需要修改esJsOptions=-Xmx1g -Xms1g里的1g为你的内存限制即可。

The chart configuration defaults the JVM heap size to 1GB with the parameter esJsOptions=-Xmx1g -Xms1g. We can override this, but to what? We can test on our local using the docker image directly:

Elasticsearch

bash

MEM=96 && \ docker rm -f elasticsearch && \ docker run -d --name elasticsearch -p 9200:9200 \ -e "discovery.type=single-node" \ -e "ES_JAVA_OPTS=-Xms${MEM}m -Xmx${MEM}m" \ elasticsearch:7.10.1