title: Prevent elasticsearch from being killed by OOM killer
body: <p>I'm new to elasticsearch and I'm guessing the way I configured my server is sub-optimal since I'm running into a problem with OOM killer killing the Elasticsearch/Java process after a short while.This could probably be avoided by having the server configured correctly. Could you please point out what in the configuration needs to be changed for a smooth operation of ES?</p>
  
  <p>On both of these servers (which are clustered), I sometimes come back to the ES/java process having been killed.</p>
  
  <p>Here is the current setup:</p>
  
  <p>===========================================</p>
  
  <p>Server 1 (Frontend server)
  This server has 8GB of RAM and is also running gunicorn, Flask, and Django</p>
  
  <p>elasticsearch.yml:</p>
  
  <pre><code>node.master: true
  node.data: true
  bootstrap.mlockall: true
  </code></pre>
  
  <p>/etc/default/elasticsearch</p>
  
  <pre><code>ES_HEAP_SIZE=5g
  MAX_OPEN_FILES=65535
  MAX_LOCKED_MEMORY=unlimited
  </code></pre>
  
  <p>===========================================</p>
  
  <p>Server 2 (Dedicated Elasticsearch server) with 8GB RAM and no other applications running</p>
  
  <p>elasticsearch.yml:</p>
  
  <pre><code>node.master: false
  node.data: true
  bootstrap.mlockall: true
  </code></pre>
  
  <p>/etc/default/elasticsearch</p>
  
  <pre><code>ES_HEAP_SIZE=5g
  MAX_OPEN_FILES=65535
  MAX_LOCKED_MEMORY=unlimited
  </code></pre>
  
  <p>===========================================</p>
  
  <p>In the elasticsearch.yml file, I see a line that says "<code>You should also make sure that the Elasticsearch process is allowed to lock the memory, eg. by using ulimit -l unlimited</code>"
  But I haven't done anything to enable that. Do I need to take any action here?</p>
  
  <p>If I try typing that in, I get...</p>
  
  <pre><code>myuser@es1:~$ sudo ulimit -l unlimited
  sudo: ulimit: command not found
  </code></pre>