1 future versions of Elasticsearch will require Java 11; your Java version from [C 2 :\Program Files\Java\jdk1.8.0_181\jre] 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的啟動,可以繼續使用。
但有潔癖怎么辦?
- 裝jdk 11
- 按提示顯示開啟屬性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 | 阿嗚的邊城
歡迎關注我的公眾號:阿嗚的編程