简体   繁体   中英

Elastic Search Immediately Dies on Mac

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 ~/.zshrc if using latest Mac OS Catalina , as they moved to ~/.zshrc and I see you just mention JAVA_HOME=$(/usr/libexec/java_home) but don't see EXPORT before this. So please add below line.

EXPORT JAVA_HOME=$(/usr/libexec/java_home) 

After that source ~/.zshrc and then close the terminal and see the output of java -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.

If your java version is different from the one that comes with Elasticsearch bundle, it'll not start. Refer to the document below:

https://www.elastic.co/guide/en/elasticsearch/reference/current/setup.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM