Installation
# add cassandra sources to /etc/apt/sources.list.d/cassandra.sources.list # cassandra version 21x sudo tee /etc/apt/sources.list.d/cassandra.sources.list <<_EOF_ deb http://www.apache.org/dist/cassandra/debian 21x main deb-src http://www.apache.org/dist/cassandra/debian 21x main _EOF_ # check if file written properly #cat /etc/apt/sources.list.d/cassandra.sources.list # add apache cassandra keys gpg --keyserver keyserver.ubuntu.com --recv-keys 4BD736A82B5C1B00 gpg --export --armor 4BD736A82B5C1B00 | sudo apt-key add - gpg --keyserver keyserver.ubuntu.com --recv-keys F758CE318D77295D gpg --export --armor F758CE318D77295D | sudo apt-key add - #sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 4BD736A82B5C1B00 # update repository sudo apt-get update # install sudo apt-get install -y cassandra # More sane default configurations - the default 50% free memory allocation is too much for me if [ "`grep 'MAX_HEAP_SIZE="' /etc/default/cassandra`" == "" ] ; then sudo tee -a /etc/default/cassandra <<"_EOF_" # Set the Max Memory used by Cassandra, change to whatever value you like MAX_HEAP_SIZE="700M" HEAP_NEWSIZE="200M" # Performance Tuning # see also : http://wiki.apache.org/cassandra/PerformanceTuning JVM_OPTS="$JVM_OPTS -XX:+UseThreadPriorities" # To lower compaction priority JVM_OPTS="$JVM_OPTS -XX:ThreadPriorityPolicy=42" # To lower compaction priority JVM_OPTS="$JVM_OPTS -Dcassandra.compaction.priority=1" # To lower compaction priority JVM_OPTS="$JVM_OPTS -XX:+UseCompressedOops" # enables compressed references, reducing memory overhead on 64bit JVMs _EOF_ fi; # restart Cassandra sudo service cassandra restart # check Cassandra status sudo service cassandra status sudo /etc/init.d/cassandra status # in case of errors, check the cassandra log files ls -l /var/log/cassandra/ #total 7228 #-rw------- 1 root root 3193386 Apr 10 14:33 output.log #-rw------- 1 cassandra cassandra 4194769 Apr 10 14:33 system.log # less /var/log/cassandra/system.log # Optional - Get Version Info about the running Cassandra Instance # 1. check Cassandra version using nodetool (best option) nodetool -h localhost version # 2. check Cassandra version using debian package manager dpkg -s cassandra |grep Version # 3. check Cassandra version using cassandra-cli and expect module sudo apt-get install -y expect expect -c "spawn cassandra-cli;expect \"exit\";send \"quit;\r\n\";"
/etc/init.d/cassandra script
I deleted the start and stop script when cleaning up the installation.
All subsequent cassandra installion never copied the cassandra init.d script anymore.
so here goes:
# download cassandra init.d script wget https://raw.github.com/guguncube/bash/master/cassandra # copy to init.d directory and set permissions sudo cp cassandra /etc/init.d/ sudo chmod +x /etc/init.d/cassandra # ensure data directory exists and has the correct permissions sudo mkdir /var/lib/cassandra/data sudo chown cassandra:cassandra -R /var/lib/cassandra
Manual installation
#create directories mkdir -p ~/build/cassandra cd ~/build/cassandra # download version="1.2.4" wget http://apache.openmirror.de/cassandra/$version/apache-cassandra-$version-bin.tar.gz tar -xvf apache-cassandra-$version-bin.tar.gz cd apache-cassandra-$version sudo ./bin/cassandra #@TODO: with time on my side - installation of init.d script and required files # e.g. #/etc/cassandra/cassandra-env.sh #/etc/cassandra/cassandra.yaml #/usr/share/cassandra/apache-cassandra.jar
References
1. Home: http://cassandra.apache.org/
2. Documentation: http://www.datastax.com/docs/1.2/index
3. Debian Packages: http://wiki.apache.org/cassandra/DebianPackaging
4. Apache Cassandra Version: http://stackoverflow.com/questions/3604857/how-do-i-tell-what-version-of-cassandra-im-running