Hot questions for Using Cassandra in centos



As undefined_variable commented, Java 8, instead of 9, worked just fine. Thanks everyone for trying to help.


I'm using Cassandra on a CentOS machine. After it failed some time ago, I restarted it via sudo service cassandra restart and started getting Connection refused error all over the place - I couldn't even run nodetool status without running into that issue.

After some digging and subsequent restarts, I noticed in the debug.log that the startup sequence gets stuck at the following:

INFO [main] 2018-04-03 09:40:15,156 - Initializing system.IndexInfo INFO [SSTableBatchOpen:1] 2018-04-03 09:40:15,851 - Global buffer pool is enabled, when pool is exahusted (max is 512 mb) it will allocate on heap DEBUG [SSTableBatchOpen:1] 2018-04-03 09:40:15,873 - Opening <path>/IndexInfo-9f5c6374d48532299a0a5094af9ad1e3/mc-300-big (58 bytes) DEBUG [SSTableBatchOpen:2] 2018-04-03 09:40:15,873 - Opening <path>3/system/IndexInfo-9f5c6374d48532299a0a5094af9ad1e3/mc-301-big (59 bytes) DEBUG [SSTableBatchOpen:3] 2018-04-03 09:40:15,873 - Opening <path>/IndexInfo-9f5c6374d48532299a0a5094af9ad1e3/mc-299-big (302 bytes)

Opening these files should take about a second - it's stuck on it for ages (as in, it never moved beyond this point). I suspect that some of the files involved must be corrupted (although I'm surprised the Java doesn't catch some sort of an exception here).

What should I do? If I delete these folders, would that result in me losing data? What other diagnostics can I run to establish the source of the problem? For the record, any sort of nodetool command exits with a "Connection Refused" error.

Version numbers: Cassandra: 3.0.9 Java: 1.8.0_162 CentOS: 6.9

Thanks for help!


It turns out that the issue was in the files involved becoming corrupted - running touch on all the files in the data folder (Data, CompressionInfo, Index, etc.) and erasing the post-crash commitlogs allowed the Cassandra to get up. A few hundred datarows were lost (probably due to me deleting the commitlogs), but at least the database is back up!


I'm trying to run cassandra as a service using a init script but I keep getting the error "Cassandra 2.0 and later require Java 7u25 or later."

In the init script I'm running cassandra under a cassandra user:

# init script for Cassandra.
# chkconfig: 2345 90 10
# description: Cassandra

. /etc/rc.d/init.d/functions


start() {
  if [ -f $CASS_PID ] && checkpid `cat $CASS_PID`; then
    echo "Cassandra is already running."
    exit 0
  echo -n $"Starting $prog: "
  daemon --user $CASS_USER $CASS_BIN -p $CASS_PID >> $CASS_LOG 2>&1
  usleep 500000
  if [ "$RETVAL" = "0" ]; then
  return $RETVAL

The cassandra user is definitely running 8u60:

> sudo runuser -l cassandra -c 'echo $JAVA_HOME'
> sudo runuser -l cassandra -c 'java -version'
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

I modified the script to print out the user and java version in with the error and they confirm that the script is seeing an older version of java but i'm not sure how that's possible when it seems fine for the cassandra user.

Cassandra 2.0 and later require Java 7u25 or later. 
Found JVM 1.6.0, patch 38, current user cassandra.

Any help appreciated!


It's not running actually as the cassandra user, just under its uid. The environment is different and doesn't contain the correct java version. Check the java version as root and it'll point to a Java 6 JRE.