0

I've installed and trying to start up Cassandra 2.0 service on my vm.

I am on CENTOS 6.

I've installed JRE 1.7 next to 1.6 and changed JAVA_HOME in /root/.bash_profile

[root@xxx log]# java -version
java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)

When I am starting my cassandra it crashes with error: Cassandra 2.0 and later require Java 7 or later.

It looks like cassandra still using old version of java 1.6? Any ideas where I can change it or any suggestions how can I fix this problem?

Thanks for any HELP!

Update:

This is my bash_profile:

export PATH
export JAVA_HOME=/opt/java/jre1.7.0_60
export PATH=/opt/java/jre1.7.0_60/bin:$PATH

I am running Cassandra by executing script in init.d.

#!/bin/bash
# chkconfig: 2345 99 01
# description: Cassandra

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

CASSANDRA_HOME=/opt/dsc-cassandra-2.0.8
CASSANDRA_BIN=$CASSANDRA_HOME/bin/cassandra
CASSANDRA_NODETOOL=$CASSANDRA_HOME/bin/nodetool
CASSANDRA_LOG=$CASSANDRA_HOME/log/cassandra.log
CASSANDRA_PID=/var/run/cassandra.pid
CASSANDRA_LOCK=/var/lock/subsys/cassandra
PROGRAM="cassandra"

if [ ! -f $CASSANDRA_BIN ]; then
  echo "File not found: $CASSANDRA_BIN"
  exit 1
fi

RETVAL=0

start() {
  if [ -f $CASSANDRA_PID ] && checkpid `cat $CASSANDRA_PID`; then
    echo "Cassandra is already running."
    exit 0
  fi
  echo -n $"Starting $PROGRAM: "
  daemon $CASSANDRA_BIN -p $CASSANDRA_PID >> $CASSANDRA_LOG 2>&1
  usleep 500000
  RETVAL=$?
  if [ $RETVAL -eq 0 ]; then
    touch $CASSANDRA_LOCK
    echo_success
  else
    echo_failure
  fi
  echo
  return $RETVAL
}

stop() {
  if [ ! -f $CASSANDRA_PID ]; then
    echo "Cassandra is already stopped."
    exit 0
  fi
  echo -n $"Stopping $PROGRAM: "
  $CASSANDRA_NODETOOL -h 127.0.0.1 decommission
  if kill `cat $CASSANDRA_PID`; then
    RETVAL=0
    rm -f $CASSANDRA_LOCK
    echo_success
  else
    RETVAL=1
    echo_failure
  fi
  echo
  [ $RETVAL = 0 ]
}

status_fn() {
  if [ -f $CASSANDRA_PID ] && checkpid `cat $CASSANDRA_PID`; then
    echo "Cassandra is running."
    exit 0
  else
    echo "Cassandra is stopped."
    exit 1
  fi
}

case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  status)
    status_fn
    ;;
  restart)
    stop
    start
    ;;
  *)
    echo $"Usage: $PROGRAM {start|stop|restart|status}"
    RETVAL=3
esac

exit $RETVAL
Wild Goat
  • 3,509
  • 12
  • 46
  • 87
  • Did you changed it with `export`? Are you sure you're starting Cassandra by root user? – Dmitry Ginzburg Jun 09 '14 at 11:26
  • try with the jdk instead of the jre – Alex Popescu Jun 14 '14 at 09:58
  • To troubleshoot, you could edit `$CASSANDRA_HOME/bin/cassandra` and look for the code that checks JAVA_HOME (about line 100). Add in some debugging like `echo $JAVA_HOME`, `which java`, and `java -version`. Then check your log to see which Java Cassandra is about to use. – BrianC Jun 14 '14 at 19:05

0 Answers0