Elasticsearch ignores my JVM heap size settings

Viewed 6188

I am running Elasticsearch inside a Docker container in Linux (Ubuntu). I am having a lot of circuit_breaking_exception problems, citing a 486.3mb limit; so I've decided to raise my JVM heap size a bit. My machine has 6 GB physical memory, so up to 3 GB should be safe for the heap size.

So I've gone to change the setting in jvm.options. The default is:

-Xms1g 
-Xmx1g

And I've changed it to:

-Xms2g 
-Xmx2g

And here comes the twist: not only I keep getting the same circuit_breaking_exception with the same size limit; echo $ES_JAVA_OPTS returns -Xmx512m -Xms512m. This is not even the default setting. I've also tried leaving the default jvm.options and creating a new user.options inside jvm.options.d, with the same result. Am I missing something? Am I doing anything wrong here?

3 Answers

As shown in the official installation of ES using docker, you can pass it as env variable

version: '2.2'
services:
  es01:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.9.2
    container_name: es01
    environment: -> it comes under environment section, removed other settings for brevity
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m" --> note this
    

You need to restart the docker container after changing this ES_JAVA_OPTS env variable value

You can pass this setting to container using env var ES_JAVA_OPTS.

docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e "ES_JAVA_OPTS=-Xms2g -Xmx2g" docker.elastic.co/elasticsearch/elasticsearch:7.9.2
Related