'Can not run Elastic Search on ubuntu (Error opening log file)
I have problems with running Elastic Search on my ubuntu 20.04 server (I can do it locally). When I run ./bin/elasticsearch
in terminal I get lines below
Exception in thread "main" java.lang.RuntimeException: starting java failed with [1]
output:
[0.000s][error][logging] Error opening log file 'logs/gc.log': Permission denied
[0.001s][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.
Could not rename log file 'logs/gc.log' to 'logs/gc.log.05' (Permission denied).
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.JvmOption.flagsFinal(JvmOption.java:119)
at org.elasticsearch.tools.launchers.JvmOption.findFinalOptions(JvmOption.java:81)
at org.elasticsearch.tools.launchers.JvmErgonomics.choose(JvmErgonomics.java:38)
at org.elasticsearch.tools.launchers.JvmOptionsParser.jvmOptions(JvmOptionsParser.java:135)
at org.elasticsearch.tools.launchers.JvmOptionsParser.main(JvmOptionsParser.java:86)
What I tried: sudo chmod -R +w /home/ubuntu/data/stepa/elasticsearch-7.16.2/logs/
. It didn't help.
I didn't succeed to find answer on elastic search forum.
Thank you for any help.
Solution 1:[1]
Finally, I found the solution. Log lines mean problems with rights. Current user has to be an owner of directory. In my case owner of /home/ubuntu/data/stepa/elasticsearch-7.16.2/logs/
was root. I changed it using this command sudo chown username:group /home/ubuntu/data/stepa/elasticsearch-7.16.2/logs
("ubuntu: " in my case because group is default and username is ubuntu)
Thanks to ilvar for clues.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | stedev |