问题
When I try to start cassandra on ubuntu 12.04 (installed via Datastax's dsc20
package) as a service as follows :
$ sudo service cassandra start
it says
*could not access pidfile for Cassandra
& no other messages or anything in logs.
But when I try to run as a root user( sudo cassandra -f
) it just works properly & cassandra is started. While trying to debug I found that when trying to run as a non-root user I was getting these messages:
ERROR 17:48:08,432 Exception encountered during startup
java.lang.AssertionError: Directory /var/lib/cassandra/data is not accessible.
..
java.io.FileNotFoundException: /var/log/cassandra/system.log (Permission denied)
..
java.lang.AssertionError: Directory /var/lib/cassandra/data is not accessible.
Is there some problem with the packaging ? Not properly installed/ configured by package ??
回答1:
By default the cassandra service does not and should not run as root.
My guess is you ran it in the foreground first, which automatically will create /var/lib/cassandra with root permissions instead of with the cassandra permissions. Either chown -R /var/lib/cassandra with the appropriate group and user or blow away the directory and try starting the service again.
回答2:
$ su cassandra
then run
$ service cassandra start
It works for me.
来源:https://stackoverflow.com/questions/22308048/starting-cassandra-as-a-service-does-not-work-for-2-0-5-sudo-cassandra-f-works