Java path is not set for Elastic Search

Hi All
Lets start the Discussion on this Topic and i am Ubuntu 16.04 and i am downloaded and installed the version 6.2.3 using sudo dpkg -i elasticsearch-6.2.3.deb and the set up is done properly but it has some problem while checking the status i have mentioned the details below please knindly help me to solve this issue

➜ ~ echo $JAVA_HOME
/data/jdk1.8.0_144
➜ ~ service elasticsearch restart
➜ ~ service elasticsearch status
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2018-04-06 16:27:00 IST; 7s ago
Docs: http://www.elastic.co
Process: 26057 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited,
Main PID: 26057 (code=exited, status=1/FAILURE)

Apr 06 16:27:00 netops-Latitude-5580 systemd[1]: Stopped Elasticsearch.
Apr 06 16:27:00 netops-Latitude-5580 systemd[1]: Started Elasticsearch.
Apr 06 16:27:00 netops-Latitude-5580 elasticsearch[26057]: could not find java; set JAVA_HOME or ensure java is in PATH
Apr 06 16:27:00 netops-Latitude-5580 systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
Apr 06 16:27:00 netops-Latitude-5580 systemd[1]: elasticsearch.service: Unit entered failed state.
Apr 06 16:27:00 netops-Latitude-5580 systemd[1]: elasticsearch.service: Failed with result 'exit-code'.

Hi @Jeni,

the Elasticsearch service from the Debian package runs as user "elasticsearch". The JAVA_HOME variable that you have shown is only set for the current user (which - I assume - is not "elasticsearch").

According to the Elasticsearch configuration docs, you can edit /etc/default/elasticsearch and set JAVA_HOME there for Elasticsearch. Can you please do this and try to start Elasticsearch again via systemd?

Daniel

Hi @danielmitterdorfer

Thanks! for your quick replay i have tryed your instruction i really happyafter solving the Java Error and still i am facing this error i don't know what is the problem with my end can you please help me with your sugesstions

● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/elasticsearch.service.d
└─override.conf
Active: failed (Result: exit-code) since Mon 2018-04-09 10:16:08 IST; 14s ago
Docs: http://www.elastic.co
Process: 6196 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=1/FAILURE)
Main PID: 6196 (code=exited, status=1/FAILURE)

Apr 09 10:16:08 netops-Latitude-5580 systemd[1]: Started Elasticsearch.
Apr 09 10:16:08 netops-Latitude-5580 systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
Apr 09 10:16:08 netops-Latitude-5580 systemd[1]: elasticsearch.service: Unit entered failed state.
Apr 09 10:16:08 netops-Latitude-5580 systemd[1]: elasticsearch.service: Failed with result 'exit-code'.

Hi @Jeni,

can you please check the logs in /var/log/elasticsearch? Wild guess: You will see one or more failing bootstrap checks there so you should follow the section important system configuration in the docs.

Daniel

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.