I'm trying to setup ElasticSearch on a Raspberry Pi, but when running sudo service elasticsearch start
I'm getting the following error in the logs:
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
I found this SO answer, which suggests to run the JVM using -XX:MaxHeapSize=512m
, but I never actually run the JVM manually.
So I tried running export _JAVA_OPTIONS="-Xmx256M"
before I run sudo service elasticsearch start
, and I also tried adding that to my .bash_profile
and rebooting before trying to start ElasticSearch again, but I still get the error. So I actually don't know if the java option is not picked up by the VM, or that it does pick it up but it just isn't the solution.
Does anybody know how I can be sure that it actually uses this argument? Or if anybody has a solution to the lack of space for the object heap that would be even better :-)
It is a question what version of elasticsearch do you use. If f.e. 5.x then in /etc/elasticsearch/ directory you should have file jvm.options where heap it can be set.
An other question is what user is staring elasticsearch. That user has to have set export JAVA_OPTIONS="-Xmx256M" but with no prefix _