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
.
2
Answers
If you’ve done an
apt
orapt-get install
,/var/log/cassandra
is where Cassandra’s logs should be.In this case, you shouldn’t be running the
cassandra
command. Try using systemctl instead:To start:
Check if it’s running:
Note that you can also check if Cassandra is running with:
I suspect that your user doesn’t have permissions to write to
/var/log
, but the Cassandra service (created byapt[-get] install
) should.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 theroot
user, file ownership on data files and logs (possibly including the directories) will reset to theroot
user and the defaultcassandra
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!