Elasticsearch启动报错:future versions of Elasticsearch will require Java 11

1 future versions of Elasticsearch will require Java 11; your Java version from [C
2 :Program FilesJavajdk1.8.0_181jre] does not meet this requirement
3 Warning: with JDK 8 on Windows, Elasticsearch may be unable to derive correct
4 ergonomic settings due to a JDK issue (JDK-8074459). Please use a newer
5 version of Java.
6 Warning: MaxDirectMemorySize may have been miscalculated due to JDK-8074459.
7 Please use a newer version of Java or set MaxDirectMemorySize explicitly.

 以上为windows下的示例。

这种情况一般是由于启用的高版本的Elasticsearch(版本7.x.x),这种情况,一般不影响Elasticsearch的启动,可以继续使用。

但有洁癖怎么办?

  1. 装jdk 11
  2. 按提示显示开启属性MaxDirectMemorySize

ES的bat脚本中写到运行属性的读取:

rem The JVM options parser produces the final JVM options to start
rem Elasticsearch. It does this by incorporating JVM options in the following
rem way:
rem   - first, system JVM options are applied (these are hardcoded options in
rem     the parser)
rem   - second, JVM options are read from jvm.options and
rem     jvm.options.d/*.options
rem   - third, JVM options from ES_JAVA_OPTS are applied
rem   - fourth, ergonomic JVM options are applied

按es读取属性的几种方式,我们可以在这四种方式中增加MaxDirectMemorySize属性。最简单的就是在jvm.options文件中添加属性即可。

在解压目录的config目录中找到jvm.options文件,用文本编辑器打开

添加MaxDirectMemorySize配置:

-XX:MaxDirectMemorySize=64m

如图:

配置后,再次启用elasticsearch,就只会提示建议使用jdk 11了。

另外,zip解压后,其实是自带一个jdk的,那么,如果有相应的jdk使用问题,我们可以在系统的环境变量中将JAVA_HOME变量配置这个es下的jdk。

欢迎关注我的博客:Awu's Blog | 阿呜的边城

欢迎关注我的公众号:阿呜的编程

原文地址:https://www.cnblogs.com/dev2007/p/13901388.html