future versions of Elasticsearch will require Java 11; your Java version from [/usr/local/jdk1.8.0_1/jre] does not meet this requirement
使用ES7版本时,启动或者执行ES命令,提示上面错误信息。这是由于ES7使用的高版本的jdk。如果不想升级服务的jdk,可以通过修改elasticsearch-env
配置文件,使用ES内置的jdk来解决上面的问题。
# now set the path to java # 注释掉原来的配置信息 #if [ ! -z "$JAVA_HOME" ]; then # JAVA="$JAVA_HOME/bin/java" # JAVA_TYPE="JAVA_HOME" #else # if [ "$(uname -s)" = "Darwin" ]; then # # macOS has a different structure # JAVA="$ES_HOME/jdk.app/Contents/Home/bin/java" # else # JAVA="$ES_HOME/jdk/bin/java" # fi # JAVA_TYPE="bundled jdk" #fi # 如何为新的配置信息 if [ ! -z "$JAVA_HOME" ]; then JAVA="$ES_HOME/jdk/bin/java" JAVA_TYPE="JAVA_HOME" else if [ "$(uname -s)" = "Darwin" ]; then # macOS has a different structure JAVA="$ES_HOME/jdk.app/Contents/Home/bin/java" else JAVA="$ES_HOME/jdk/bin/java" fi JAVA_TYPE="bundled jdk" fi