I downloaded elastic search today. When I try to run it, it is immediately killed with the following message:
Johnathans-MacBook-Pro:Downloads jward$ ./elasticsearch-7.6.1/bin/elasticsearch
./elasticsearch-7.6.1/bin/elasticsearch-env: line 71: 12909 Killed: 9
"$JAVA" -cp "$ES_CLASSPATH" org.elasticsearch.tools.java_version_checker.JavaVersionChecker
My java version is:
java version "11.0.6" 2020-01-14 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.6+8-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.6+8-LTS, mixed mode)
Why won't the elastic search service start?
Elasticsearch isn't able to recognize your Java version and that's the reason it is failing. Please see in your logs, the error is thrown from the below class and you can have a look at from below source code.
https://github.com/elastic/elasticsearch/blob/master/distribution/tools/java-version-checker/src/main/java/org/elasticsearch/tools/java_version_checker/JavaVersionChecker.java#L28 and you can have a look at this class, All it does is
checks if the runtime Java version is at least 1.8..In your case its java 11, so java version isn't a problem, the problem lies in Elasticsearch not recognizing that.
You need to set proper JAVA_HOME in your
~/.zshrcif using latest Mac OSCatalina, as they moved to~/.zshrcand I see you just mentionJAVA_HOME=$(/usr/libexec/java_home)but don't seeEXPORTbefore this. So please add below line.After that
source ~/.zshrcand then close the terminal and see the output ofjava -version, if it shows java 11 version then you are good to go and run the elasticsearch again.Hope this helps and let me know if you have further questions.