Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure access permissions for Cassandra on Linux Ubuntu

Thank-you for reading this. I am stuck at step three on this tutorial pertaining to installing Cassandra: http://wiki.apache.org/cassandra/GettingStarted#Step_3:_Start_Cassandra

I can only run this software as root. (shouting this over fictional helicopter noise) This seem like a terrible way to run the software.

When starting the Cassandra server as my normal user I receive the following errors:

1.) 15:46:00,147 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - openFile(/var/log/cassandra/system.log,true) call failed. java.io.FileNotFoundException: /var/log/cassandra/system.log (Permission denied)

2.) ERROR 20:46:00 Doesn't have write permissions for /var/lib/cassandra/data directory

I tried changing the permissions several times and nothing has worked. I tried changing the /var/log/cassandra/system.log permissions for read/write for the cassandra group on the operating-system (OS). The command I used to do this was, sudo chmod 664 /var/log/cassandra/system.log. I found this page helpful in determining how to change the permissions:http://www.linux.org/threads/file-permissions-chmod.4094/

Then, I added my user-name to the cassandra group. From my understanding running the /usr/sbin/cassandra -f command as my user should allow me to access the /var/log/cassandra/system.log file, which would solve one of the errors, error number 1 above.

Respectfully,

user

like image 302
user3808269 Avatar asked Oct 09 '15 21:10

user3808269


2 Answers

I found a solution! I ran sudo -u cassandra /usr/sbin/cassandra -f and then ran into problems with the commitlog directory Phact mentions in his answer. I then ran Phact's recursive chown command, sudo chown -R cassandra:cassandra /var/lib/cassandra/commitlog and the Cassandra server started up correctly just as it would if I was running the program as the root user. :D :D :D

like image 83
user3808269 Avatar answered Oct 26 '22 19:10

user3808269


Give the user you want permissions to the data and commitlog dirs.

sudo chown -R cassandra:cassandra /var/lib/cassandra/data


sudo chown -R cassandra:cassandra /var/lib/cassandra/commitlog
like image 20
phact Avatar answered Oct 26 '22 18:10

phact