Starting cassandra as a service does not work for 2.0.5, sudo cassandra -f works

ぃ、小莉子 提交于 2019-12-19 04:19:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!