Elasticsearch 7.3 homebrew

一曲冷凌霜 提交于 2021-02-07 17:12:24

问题


I was using Elasticsearch 6.8 via homebrew, now I was trying to upgrade to 7.3. Now on 6.8 I already got a warning about a log file that did not exist but the server would still run.

Now with 7.3 I get a error and the server wont run:

Exception in thread "main" java.lang.RuntimeException: starting java failed with [1]
output:
[0.002s][error][logging] Error opening log file 'logs/gc.log': No such file or directory
[0.002s][error][logging] Initialization of output 'file=logs/gc.log' using options 'filecount=32,filesize=64m' failed.
error:
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
Invalid -Xlog option '-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m', see error log for details.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
    at org.elasticsearch.tools.launchers.JvmErgonomics.flagsFinal(JvmErgonomics.java:111)
    at org.elasticsearch.tools.launchers.JvmErgonomics.finalJvmOptions(JvmErgonomics.java:79)
    at org.elasticsearch.tools.launchers.JvmErgonomics.choose(JvmErgonomics.java:57)
    at org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:89)

I tried creating the dir/file where elasticsearch was installed, but that did not work for me (or i did something wrong).

Anyone advice?


回答1:


Reference: https://onecompiler.com/questions/3uwszcf3x/homebrew-installed-elasticsearch-failing-to-start

I have fixed this by changing the relative logs/gc.log path to an absolute path. Follow the below steps to solve the issue

  1. Open jvm.options file which is located at /usr/local/etc/elasticsearch/jvm.options

  2. Change the relative path to an absolute path from the following

# JDK 9+ GC logging
9-:-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m

to

# JDK 9+ GC logging
9-:-Xlog:gc*,gc+age=trace,safepoint:file=/usr/local/var/log/elasticsearch/gc.log:utctime,pid,tags:filecount=32,filesize=64m
  1. Restart elasticsearch $ brew services restart elasticsearch-full or just start it without daemon - $ elasticsearch


来源:https://stackoverflow.com/questions/57479986/elasticsearch-7-3-homebrew

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!