0

I need to increase the memory limits of elasticsearch in debian..Please let me know in which file should i make changes to increase it's memory..also how to check whether the memory limits are set or not...as I was getting an error something like: Too many Files Open Plz help...

Thanks in advance.

Rajni
  • 117
  • 1
  • 3
  • 11
  • 2
    there is file like /etc/init.d/elasticsearch...and it contains the code like ES_HOME=/usr/local/elasticsearch ES_MIN_MEM=256m ES_MAX_MEM=2g DAEMON=$ES_HOME/bin/elasticsearch NAME=elasticsearch DESC=elasticsearch PID_FILE=/var/run/$NAME.pid LOG_DIR=/var/log/$NAME DATA_DIR=/var/lib/$NAME WORK_DIR=/tmp/$NAME CONFIG_FILE=/etc/$NAME/elasticsearch.yml ...please let me know if i need to set the max and min memory limits here? also where to set the max number of open files? – Rajni Oct 18 '12 at 12:05

4 Answers4

4

The best way to set the memory is to set the ES_HEAP_SIZE parameter, and let that dictate the min and max values.

For Ubuntu just open the elasticsearch file in /etc/default:

sudo vim /etc/default/elasticsearch

and make sure that the following line is either set or uncommented, and set it to half of your total ram:

ES_HEAP_SIZE=4g

Then save your file, and restart elasticsearch:

sudo service elasticsearch restart

For more info on setting the heap size you can check out this article here. Granted the guide tells you to just create an environmental variable using the export command; however, that did not work for me, though the /etc/default/elasticsearch file will work, even after a restart.

Note: do not set the heap size over 32Gb. Using decimals for your heap_size will break Elasticsearch. If you need to use partial Gb's then use Mb like this: ES_HEAP_SIZE=3750m. Works like a charm.

Maximus
  • 1,417
  • 15
  • 19
2

Rajni is absolutely right. I had the same question as OP and found all of the values set within the service script near the beginning:

ES_HOME=/opt/elasticsearch
ES_MIN_MEM=256m
ES_MAX_MEM=2g
DAEMON=$ES_HOME/bin/elasticsearch
NAME=elasticsearch
DESC=elasticsearch
PID_FILE=/var/run/$NAME.pid
LOG_DIR=/var/log/$NAME
DATA_DIR=/var/lib/$NAME
WORK_DIR=/tmp/$NAME
CONFIG_FILE=$ES_HOME/config/elasticsearch.yml
Daniel Agans
  • 657
  • 1
  • 6
  • 14
1

Lol, my rep is too low simply answer: but I just want to confirm that the file /etc/init.d/elasticsearch contains startup info. MIN and MAX_MEM are min and max heap size

I'm pretty sure if you're on systemd the equivalent file will be under /etc/default/

Restart elasticsearch for your settings to take effect. If you're on systemd: sudo systemctl restart elasticsearch. If it fails to restart due to bad settings, sudo systemctl status elasticsearch

This answer discusses a few other options How to change Elasticsearch max memory size

Community
  • 1
  • 1
0

update the JVM heap size in jvm.options file

Stop the elasticsearch

File Path: /etc/elasticsearch/

Command: sudo nano /etc/elasticsearch/jvm.options

=> Uncomment and update the JVM heap size:

enter image description here