23

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?

Eric Leschinski
  • 146,994
  • 96
  • 417
  • 335
Ababneh A
  • 1,104
  • 4
  • 15
  • 32
  • Does your database contain any data? Or is this a new install? – Aaron Aug 10 '12 at 13:00
  • 1
    It is a new install, previously, I installed the ubuntu packaged cassandra 1.0 using apt-get, and it used to start without problems. Anyway, 2 days later, I uninstalled cassandra 1.0 by removing the folders manually, and installed the tarball for cassandra 1.1 (following the instructions in the official website) – Ababneh A Aug 10 '12 at 13:39
  • Correction: I followed the instructions in the README file, not form the website – Ababneh A Aug 10 '12 at 14:01
  • Did your cassandra.yaml remain the same? Is it referencing the correct data_file_directories? If so, try pointing it to a new (empty) directory and see if it comes-up. – Aaron Aug 10 '12 at 19:08
  • I checked cassandra.yaml, and it was referencing an old directory that does not exist anymore (probably related to the previous installation). I set the following: data_file_directories: /db/cassandra/data, and also: commitlog_directory: /db/cassandra/commitlog, and, saved_caches_directory: /db/cassandra/commitlog. I tried agian, but cassandra did not come up, and the terminal returned the same error. – Ababneh A Aug 10 '12 at 21:11
  • Also affects Cassandra 1.2.2 on Red Hat Enterprise Linux 6. – Raedwald Feb 28 '13 at 15:49

4 Answers4

28

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:

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.

Beryllium
  • 12,808
  • 10
  • 56
  • 86
grkvlt
  • 2,577
  • 1
  • 21
  • 38
4

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.

rs_atl
  • 8,935
  • 1
  • 23
  • 28
0

I had the same. Flowing steps helped me.

Remove cassandra $ apt-get remove cassandra

Update apt repos $ sudo add-apt-repository ppa:webupd8team/java

Reinstall java $ sudo apt-get install oracle-java8-set-default

Install cassandra again $ apt-get install cassandra

I was using information from that page

Ihor
  • 461
  • 4
  • 8
-1

Try using the command - ./cassandra -f start if you are sure you have set up the env variables correctly

Krishna
  • 3
  • 4