[ 
https://issues.apache.org/jira/browse/CASSANDRA-10920?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksey Yeschenko updated CASSANDRA-10920:
------------------------------------------
    Component/s: Packaging

> Let systemd know if Cassandra is running
> ----------------------------------------
>
>                 Key: CASSANDRA-10920
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-10920
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Packaging
>            Reporter: Severin Leonhardt
>            Priority: Minor
>              Labels: lhf
>
> Checking the status of the Cassandra service on CentOS 7 shows this:
> {noformat}
> $ systemctl status cassandra
> ● cassandra.service - SYSV: Starts and stops Cassandra
>    Loaded: loaded (/etc/rc.d/init.d/cassandra)
>    Active: active (exited) since Fri 2015-12-18 13:30:02 CET; 3 days ago
>      Docs: man:systemd-sysv-generator(8)
> ...
> {noformat}
> The same is shown after the Cassandra process is killed or dies by itself. 
> Notice this part: _Active: active (exited)_
> Starting Cassandra through {{systemctl start cassandra}} will not work, 
> because systemd still thinks the service is running.
> According to the [systemd documentation regarding compatibility with 
> SysV|http://www.freedesktop.org/wiki/Software/systemd/Incompatibilities/] 
> this is expected behavior. Systemd doesn't know the PID of the Cassandra 
> process and thus can't check if the service is running or not.
> It is suggested to add the following to the SysV script header comment:
> {noformat}
> # pidfile: /var/run/cassandra/cassandra.pid
> {noformat}
> After adding this manually systemd correctly detected the state of the 
> Cassandra process on our machines.
> *Update: /var/run/cassandra is missing after reboot*
> Since CentOS 7 /var/run is a symlink to /run which is tmpfs-mounted. This 
> makes /var/run/cassandra go away after a reboot and the PID file is never 
> created again. (With the above change systemd even fails because it can't 
> find the PID file.)
> I suggest adding this to make sure the directory for the PID file exists:
> {noformat}
> start)
>     # Cassandra startup
>     echo -n "Starting Cassandra: "
> +   pid_dir=`dirname $pid_file`
> +   [ -d $pid_dir ] || install -m 755 -o $CASSANDRA_OWNR -d $pid_dir
>     su $CASSANDRA_OWNR -c "$CASSANDRA_PROG -p $pid_file" > $log_file 2>&1
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to