Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

somrcha1_186924 avatar image
somrcha1_186924 asked ·

Cassandra 3.11.6 failed to start as a service

Hi, I have installed cassandra,but not able to start it as service.

I have searched and found some change to be made in cassandra script in /etc/init.d and changed.

Now it is starting but getting stopped immediately

echo -n "Starting Cassandra: "
[ -d `dirname "$pid_file"` ] || \
install -m 755 -o $CASSANDRA_OWNR -g $CASSANDRA_OWNR -d `dirname $pid_file`
- su $CASSANDRA_OWNR -c "$CASSANDRA_PROG -p $pid_file" > $log_file 2>&1
+ runuser -u $CASSANDRA_OWNR -- $CASSANDRA_PROG -p $pid_file > $log_file 2>&1
retval=$?
+ chown root.root $pid_file
[ $retval -eq 0 ] && touch $lock_file
echo "OK"
;;
stop)
# Cassandra shutdown
echo -n "Shutdown Cassandra: "
- su $CASSANDRA_OWNR -c "kill `cat $pid_file`"
+ runuser -u $CASSANDRA_OWNR -- kill `cat $pid_file`
retval=$?
[ $retval -eq 0 ] && rm -f $lock_file
for t in `seq 40`; do

RHEL 7.7

Java 1.8

cassandra
2 comments
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

@somrcha1_186924 There isn't enough info in your post. You need to provide the errors/outputs you're seeing. Also, you didn't specify what changes you made and why. Please edit your question so we can assist. Cheers!

0 Likes 0 · ·

Hi Erick,


Thanks . The issue is resolved now.

Please recheck my original question where I mentioned the cassandra script in /etc/init.d path

I have removed the below lines from script (preceded by - sign)

su $CASSANDRA_OWNR -c "$CASSANDRA_PROG -p $pid_file" > $log_file 2>&1

su $CASSANDRA_OWNR -c "kill `cat $pid_file`"


And added the below lines to script (preceded by + sign)

runuser -u $CASSANDRA_OWNR -- $CASSANDRA_PROG -p $pid_file > $log_file 2>&1

chown root.root $pid_file

runuser -u $CASSANDRA_OWNR -- kill `cat $pid_file`


0 Likes 0 · ·

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered ·

@somrcha1_186924 There was an issue with init scripts on RHEL systems with newer versions of systemd which were patched for CVE-2018-16888. The Cassandra script needed to be modified so that PID files are owned by the root user (CASSANDRA-15273).

As you stated, you have applied the workaround. The fix will be included in the next release of Cassandra. Cheers!

1 comment Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Thanks Erick for the clarification.

0 Likes 0 · ·