Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot start Cassandra db using bin/cassandra

Tags:

cassandra

I have Ubuntu 12.04 with cassandra 1.1.3 (tarball installation), When I try to start cassandra, I get the following:

user@ubuntu:~/apache-cassandra-1.1.3/bin$ sudo ./cassandra -f
xss =  -ea -javaagent:./../lib/jamm-0.2.5.jar -XX:+UseThreadPriorities -XX:ThreadPriorityPolicy=42 -Xms4G -Xmx4G -Xmn800M -XX:    +HeapDumpOnOutOfMemoryError -Xss128k
user@ubuntu:~/apache-cassandra-1.1.3/bin$ 

According to cassandra documentation, the output does not look as expected:

The service should start in the foreground and log gratuitously to 
standard-out. Assuming you don't see messages with scary words like  
"error", or "fatal", or anything that looks like a Java stack trace,  
then chances are you've succeeded.

So, what is the problem?

like image 641
Ababneh A Avatar asked Aug 10 '12 12:08

Ababneh A


2 Answers

The problem may be caused by using OpenJDK, as described in a Cassandra bug report but, see the comments here for occurrences of this issue on Sun/Oracle and other JVMs:

  • https://issues.apache.org/jira/browse/CASSANDRA-2441

If you cannot install the Oracle JVM, then try changing the stack size in the conf/cassandra-env.sh configuration script. Look for the following section, at around line 185, and change the -Xss180k to a higher value.

if [ "`uname`" = "Linux" ] ; then
  # reduce the per-thread stack size to minimize the impact of Thrift
  # thread-per-client.  (Best practice is for client connections to
  # be pooled anyway.) Only do so on Linux where it is known to be
  # supported.
  # u34 and greater need 180k
  JVM_OPTS="$JVM_OPTS -Xss180k"
fi
echo "xss = $JVM_OPTS"

I have used 280k successfully when testing installations on Ubuntu servers at Rackspace and Amazon.

Based on reports in the comments below, I would either suggest increasing the stack size in 20k increments, starting with -Xss200k, until Cassandra starts properly. Note that it is also possible to remove this option and use the default stack size per thread, but be aware of the impact this will have on memory consumption.

like image 135
grkvlt Avatar answered Dec 31 '22 23:12

grkvlt


This is most likely caused by attempting to run under OpenJDK 1.6, which causes a segmentation fault under Ubuntu/Debian. The seg fault is hidden because of the way the shell script executes the process. You can test for this problem by modifying $CASSANDRA_HOME/bin/cassandra as follows:

Change this line:

exec $NUMACTL "$JAVA" $JVM_OPTS $cassandra_parms -cp "$CLASSPATH" $props "$class"

to this:

echo $NUMACTL "$JAVA" $JVM_OPTS $cassandra_parms -cp "$CLASSPATH" $props "$class"

Then run bin/cassandra -f and copy the resulting java command. Run this directly to see if it produces the segmentation fault. If this is your problem, you need to switch to the Sun or IBM JDK, or alternatively you can upgrade to OpenJDK 1.7.

like image 44
rs_atl Avatar answered Jan 01 '23 00:01

rs_atl