我通过自制软件使用Elasticsearch 6.8,现在我正尝试升级到7.3。现在在6.8上,我已经收到有关不存在的日志文件的警告,但是服务器仍可以运行。
现在使用7.3时出现错误,服务器将无法运行:
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)
我尝试创建安装了Elasticsearch的目录/文件,但这对我不起作用(或者我做错了什么。)
有人建议吗?
答案 0 :(得分:3)
参考:https://onecompiler.com/questions/3uwszcf3x/homebrew-installed-elasticsearch-failing-to-start
我已通过将相对日志/gc.log路径更改为绝对路径来解决此问题。请按照以下步骤解决问题
打开位于/usr/local/etc/elasticsearch/jvm.options的jvm.options文件
将相对路径更改为绝对路径 从以下
# JDK 9+ GC logging
9-:-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m
到
# 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
$ brew services restart elasticsearch-full
或仅在没有守护程序的情况下启动它-$ elasticsearch