This post is mainly used as a personal memo, but you may find something useful if you are a beginner.
- Install Java
- Download and install Cassandra
- Configuring Cassandra
- Starting Cassandra
- Other tweaks
Make sure $JAVA_HOME is properly set.
Cassandra can be downloaded from http://cassandra.apache.org/download/:
wget http://mirror.ox.ac.uk/sites/rsync.apache.org/cassandra/2.0.9/apache-cassandra-2.0.9-bin.tar.gz
To install, simply unzip it:
tar -zxvf apache-cassandra-2.0.9-bin.tar.gz
The configuration make differ a bit in different Cassandra versions. Taking 2.0.9 as a example.
In conf/cassandra.yaml, search for the following key words, and change the directory if necessary:
1. data_file_directories
2. commitlog_directory
3. saved_caches_directory
In log4j-server.properties, change log4j.appender.R.File to your preferred log file location.
To start Cassandra, run /bin/cassandra -f. You can run it in different modes. By default it is running in background mode. -f option indicates running in foreground mode. If running in background mode, it is suggested to use /bin/cassandra -p pid_file. pid_file is the file name where the Cassandra background process PID will be written to, so later to kill the process, you can simply run kill `cat pid_file`.
In conf/cassandra-env.sh, it will try detect your system free memory. If you don’t have permission to run the “free” command, change the command for setting “system_memory_in_mb” to the following:
system_memory_in_kb=`cat /proc/meminfo | grep MemFree | awk ‘/:/ {print $2;exit}’`
system_memory_in_mb=${system_memory_in_kb%.*}