Search code examples
ubuntucassandracqlshlogfile

Where should "/log/cassandra/gc.log" file be on Ubuntu?


When I try whereis cassandra I get:

cassandra: /usr/sbin/cassandra /etc/cassandra /usr/share/cassandra

And which cassandra gives me:

/usr/sbin/cassandra

But when I try cqlsh I get:

Connection error: ('Unable to connect to any servers', {'127.0.0.1:9042': ConnectionRefusedError(111, "Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused")})

Also the following is the result for cassandra command:

precated in version 9.0 and will likely be removed in a future release.
[0.001s][error][logging] Error opening log file '/var/log/cassandra/gc.log': No such file or directory
[0.001s][error][logging] Initialization of output 'file=/var/log/cassandra/gc.log' using options 'filecount=10,filesize=10485760' failed.
Invalid -Xlog option '-Xlog:gc=info,heap*=trace,age*=debug,safepoint=info,promotion*=trace:file=/var/log/cassandra/gc.log:time,uptime,pid,tid,level:filecount=10,filesize=10485760', see error log for details.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

It seems I don't have a gc.log file but I don't know where should I create such a file as I have 3 related places shown by trying whereis cassandra.


Solution

  • If you have installed Cassandra as a package, the log files will be created in /var/log/cassandra.

    Package installations will automatically create an operating system user called cassandra and all data files and logs will be owned by this user. However, if you have accidentally started Cassandra as the root user, file ownership on data files and logs (possibly including the directories) will reset to the root user and the default cassandra user will no longer have permissions.

    Check the file and directory permissions on the following:

    • /var/lib/cassandra/*
    • /var/log/cassandra/*

    If necessary, reset the ownership and permissions back to the cassandra user. Cheers!