macos - 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.
推荐阅读
- c++ - EM_ASM 中的 js 代码会发生什么?
- java - 如何按属性比较对象
- amazon-web-services - 零突发信用余额的 AWS EFS 死锁
- multithreading - 是否可以为 3 个进程及更多进程实现彼得森的算法?
- java - HSQLDB ANY 数组函数不起作用
- javascript - 如何为单个html元素赋予多个类
- php - 在列表中显示所有状态为“user”或“admin”的用户
- dart - 为什么此回调在此飞镖方法中显示为 null
- python - Keras 中的人脸分类 CNN 没有正确训练
- python - 通过 socks5 代理使用 telepot(telegram bot python 包)