1

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?

spyderman4g63
  • 4,087
  • 4
  • 22
  • 31
  • did you try to check logs? – Ilia Maskov Mar 06 '20 at 19:21
  • which type of installation u used out of the ones listed here https://www.elastic.co/guide/en/elasticsearch/reference/current/install-elasticsearch.html –  Mar 07 '20 at 09:22
  • Elasticsearch will pick up the environment variable `JAVA_HOME`. Have you set that one? Check with `echo $JAVA_HOME `. – xeraa Mar 07 '20 at 19:44
  • I downloaded the tar file for mac and unzipped it. Ran ./bin/elasticsearch. There are no files generated in the logs directory. I don't think JAVA_HOME is set. – spyderman4g63 Mar 08 '20 at 00:22
  • I set JAVA_HOME=$(/usr/libexec/java_home) but it still dies – spyderman4g63 Mar 08 '20 at 00:27

2 Answers2

2

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.

Amit
  • 30,756
  • 6
  • 57
  • 88
-1

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

  • 1
    This might just be phrased in a misleading way, but Elasticsearch 7.6.x will work with version 1.8, 11, and 13. For the specific flavors refer to the [JVM matrix](https://www.elastic.co/support/matrix#matrix_jvm) – xeraa Mar 07 '20 at 19:42
  • agree with Xeraa, it just check which java_version is set in your system and if doesn't match with jvm_matrix , then throws clear error mentioning the java version – Amit Mar 08 '20 at 06:33
  • @OpsterElasticsearchNinja I don't get any errors but `/usr/local/Cellar/elasticsearch-full/7.7.0/libexec/bin/elasticsearch-env: line 77: 16617 Killed: 9 "$JAVA" "$XSHARE" -cp "$ES_CLASSPATH" org.elasticsearch.tools.java_version_checker.JavaVersionChecker` – Saddle Point May 14 '20 at 04:41
  • @stackunderflow is your service up ? – Amit May 14 '20 at 04:45
  • @OpsterElasticsearchNinja No, it was killed immediately. When I look into the log file, I can find the only same string just I what it printed into the terminal. I can't see any further details about it. – Saddle Point May 14 '20 at 05:56
  • @stackunderflow, which version of ES and java and on which OS and what configuration u are running? – Amit May 14 '20 at 10:09
  • @OpsterElasticsearchNinja I updated ES to 7.7.0 three days ago and I notice that it does not support JDK 13 any more. So I completely remove JDK 13 from my macOS and left 8 and 11 only. I start from a fresh install from `brew` with `elastic/tap/elasticsearch-full` without any special configs. The crazy part is I don't know how to get more error details... – Saddle Point May 15 '20 at 08:07
  • @stackunderflow I would suggest you ask a diff ques with all details so that it can reach to border audience and would be more useful for the community. – Amit May 15 '20 at 08:52