Setting the Memory Used by Elasticsearch

Setting the Memory Used by Elasticsearch

Question

Can I increase the JVM for Elasticsearch?

Answer

Yes, it is possible to adjust the Elasticsearch JVM size. By default, Digital Hive sets the Elasticsearch JVM to 500 MB for each node and this is sufficient for most environments. If your environment has a large amount of data to index or you're seeing memory errors in the Elasticsearch logs, you will want to increase the JVM.

Adjusting the Elasitcsearch JVM in Windows

  1. In Services, stop Digital - node1, Elasticsearch 5.5.1 (DigitalHive_9200) and Elasticsearch 5.5.1 (DigitalHive_9201) 
  2. In File Explorer, navigate to DigitalHive\Elasticsearch\bin
  3. Right click elasticsearch-service-mgr
  4. Select Send to > Desktop (create shortcut)
  5. Rename the shortcut to indicate this is node1, for example elasticsearch-node1
  6. Right click elasticsearch-node1 and select Properties
  7. In Target, append  //ES//DigitalHive_9200
  8. Click OK
  9. Double click elastiscsearch-node1
  10. Click Yes
  11. Click the Java tab
  12. Set Initial memory pool and Maximum memory pool to the size you want. In this example, I increased it to 1 GB
  13. Clik OK
  14. Repeat steps 2 to 13, except name this shortcut elasticsearch-node2 and in Target append //ES//DigitalHive_9201
  15. In Services, start Elasticsearch 5.5.1 (DigitalHive_9200), Elasticsearch 5.5.1 (DigitalHive_9201) and DigitalHive - node1
Elasticsearch is now configured for a 1 GB JVM for each node.

Adjusting the Elasitcsearch JVM in Linux

  1. Navigate to your DigitalHive home, in this example, cd /home/mk3admin/DigitalHive
  2. Stop Digital HIve by running ./stopAll.sh
  3. Edit DigitalHive home/Elasticsearch/config/jvm.options, for example, vi /home/mk3admin/DigitalHive/Elasticsearch/config/jvm.options
  4. Change the -Xms512m and -Xmx512m to the size you want, for example, if you want to set the JVM to 1 GB, then set them to -Xms1g -Xmx1g
  5. Save :wq
  6. Start DigitalHive by running ./startAll.sh
Elasticsearch is now configured for a 1 GB JVM for each node.