I am getting following error while running the cassandra.
$ sudo service cassandra start
$ cassandra
Java HotSpot(TM) Server VM warning: Cannot open file /var/log/cassandra/gc.log due to Permission denied.
I guess you have installed the Cassandra using repositories. Cassandra needs a directory to store data and in your case, it cannot create that directories because of permission problems. You have three-way:
sudo su
and run the command cassandra
as the root user. You can issue the command sudo systemctl enable cassandra.service
to run Cassandra automatically at startup.change the following setting in cassandra.yaml
file to where the user has permission, like your home directory.
data_file_directories
commitlog_directory
saved_caches_directory
add the line export CASSANDRA_HOME=path/to/cassandra
in user .bashrc
file and after that run source .bashrc
to compile it. This makes Cassandra know the Cassandra install directory and creates the nesseccery folder within that.