Reputation: 564
On our servers we are using more than one Java JDK. I'm not able to change this, as we have dependencies for older Java versions. Therefore I'm not able to start the current elasticsearch version (1.5.2) as it needs a JDK > 1.7.0_55, although we have other versions, including a 1.7.0_79, installed. The old version executable is stored under /bin while the newer ones are installed to /usr/jdk1.x.x_xx/bin. I haven't found any option in the /etc/elasticsearch/elasticsearch.yml to set the path to the java executable. I also tried to set the environment vars $PATH and $JAVA_HOME to the newer version, but without any luck. Is there a way to force elasticsearch to use a newer version instead of the old one?
Upvotes: 0
Views: 2718
Reputation: 181
Updating the sysconfig
is better approach so any of the scripts don't pick another JDK.
In my case it worked when I updated the elasticsearch config in /etc/sysconfig/elasticsearch
This is pretty much as advised in https://www.elastic.co/guide/en/elasticsearch/reference/current/rpm.html
Upvotes: 1
Reputation: 3874
Go to the elasticsearch bash script that is used to launch elasticsearch.
If you have installed with an RPM it is located at:
/usr/share/elasticsearch/bin/elasticsearch
Then search for the function launch_service() At the first line of the function add the following line:
JAVA=/usr/java/jdk1.8.0_25/bin/java
Then:
service elasticsearch restart
It will pick up what ever java version you set in the line you added.
Upvotes: 3