将 cassandra 作为服务启动不适用于 2.0.5, sudo cassandra -f 有效 [英] Starting cassandra as a service does not work for 2.0.5, sudo cassandra -f works

查看:10
本文介绍了将 cassandra 作为服务启动不适用于 2.0.5, sudo cassandra -f 有效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在 ubuntu 12.04(通过 Datastax 的 dsc20 包安装)作为服务启动 cassandra 时:

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

$ sudo service cassandra start

它说

*无法访问 Cassandra 的 pidfile

*could not access pidfile for Cassandra

&日志中没有其他消息或任何内容.

& no other messages or anything in logs.

但是当我尝试以 root 用户身份运行时(sudo cassandra -f),它运行正常&cassandra 已启动.在尝试调试时,我发现当尝试以非 root 用户身份运行 时,我收到以下消息:

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 ??

推荐答案

默认情况下,cassandra 服务不会也不应该以 root 身份运行.

By default the cassandra service does not and should not run as root.

我的猜测是你首先在前台运行它,它会自动创建/var/lib/cassandra 具有 root 权限而不是 cassandra 权限.使用适当的组和用户 chown -R/var/lib/cassandra 或删除目录并再次尝试启动服务.

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.

这篇关于将 cassandra 作为服务启动不适用于 2.0.5, sudo cassandra -f 有效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆