6

What do /var/log files serve for?When I try to run cassandra on my Ubuntu 16.04

OpenJDK 64-Bit Server VM warning: Cannot open file /var/log/cassandra/gc.log due to Permission denied

Later

19:47:58,887 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[SYSTEMLOG] - Active log file name: /var/log/cassandra/system.log
19:47:58,887 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[SYSTEMLOG] - File property is set to [/var/log/cassandra/system.log]
19:47:58,889 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[SYSTEMLOG] - openFile(/var/log/cassandra/system.log,true) call failed. java.io.FileNotFoundException: /var/log/cassandra/system.log (Permission denied)
    at java.io.FileNotFoundException: /var/log/cassandra/system.log (Permission denied)

Why do I have these problems? This is my java

java -version
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

These are the permissions

/var/log$ ls -la cassandra/
total 300
drwxr-xr-x  2 cassandra cassandra   4096 jan.  25 15:50 .
drwxrwxr-x 14 root      syslog      4096 jan.  25 15:49 ..
-rw-r--r--  1 cassandra cassandra 184448 jan.  25 19:50 debug.log
-rw-r--r--  1 cassandra cassandra  59956 jan.  25 19:50 gc.log.0.current
-rw-r--r--  1 cassandra cassandra  41363 jan.  25 19:50 system.log
karel
  • 110,292
  • 102
  • 269
  • 299
MikiBelavista
  • 1,193
  • 5
  • 22
  • 33

1 Answers1

9

I was facing the same issue, fixed using following commands:

sudo chown -R $USER:$GROUP /var/lib/cassandra/

sudo chown -R $USER:$GROUP /var/log/cassandra/

  • 1
    This helped me solve `cassandra nodetool : Failed to connect to '127.0.0.1:7199'` issue. After following this answer(https://stackoverflow.com/a/52456917/830309) and the `instruction` link in the third paragraph of that answer, I ran the above two `chown` commands, ran `$ cassandra` on my local machine which I believe starts Cassandra. Then ran `$ nodetool status` again and it connected. – daniel blythe May 14 '20 at 08:31