This section provides instructions for installing and setting up a self-contained, single-node cluster of Cassandra in your home directory that does not require root permissions using the binary tarball packages.
Note
The instructions in this section are intended for a quick start tutorial, not for production installations. See Planning a Cassandra Cluster Deployment, Installing a Cassandra Cluster, and Initializing a Multiple Node Cluster in a Single Data Center for production cluster setup best practices.
Cassandra is a Java program and requires that a Java Virtual Machine (JVM) is installed before starting the server. For production deployments, you will need the Oracle Java Runtime Environment 1.6.0_19 or later, but if you are installing only an evaluation cluster, any JVM is fine.
To check for Java, run the following command in a terminal window:
$ java -version
If you do not have Java installed, see Installing Oracle JRE for instructions.
Note
By downloading community software from DataStax you agree to the terms of the DataStax Community EULA (End User License Agreement) posted on the DataStax web site.
From your home directory, download the Cassandra package (required), and the OpsCenter package(optional):
For example, on Linux to get the latest versions of DataStax and OpsCenter Community Editions and the Portfolio Demo:
$ curl -OL http://downloads.datastax.com/community/dsc.tar.gz
$ curl -OL http://downloads.datastax.com/community/opscenter.tar.gz
Unpack the distributions:
$ tar -xzvf dsc.tar.gz
$ tar -xzvf opscenter.tar.gz
$ rm *.tar.gz
Rename the untarred directory to datastax:
$ mv dsc-cassandra-1.1.x datastax
In the datastax directory, create the data and logging directory for Cassandra.
$ cd datastax
$ mkdir cassandra-data
In cassandra-data, create the following directories: saved_caches and commitlog.
$ cd cassandra-data
$ mkdir data
$ mkdir saved_caches
$ mkdir commitlog
After installing a single-node Cassandra cluster in your home directory, you must set some configuration properties. These properties are specified in the cassandra.yaml and log4j-server.properties files.
Go the directory containing the cassandra.yaml file:
$ cd <USER_HOME>/datastax/conf
Edit the following lines in cassandra.yaml:
initial_token: 0
data_file_directories: - <USER_HOME>/datastax/cassandra-data/data
commitlog_directory: <USER_HOME>/datastax/cassandra-data/commitlog
saved_caches_directory: <USER_HOME>/datastax/cassandra-data/saved_caches
In the conf directory, change the log4j-server.properties file:
log4j.appender.R.File= <USER_HOME>/datastax/cassandra-data/system.log
Start the Cassandra server in the background.
$ cd <USER_HOME>/datastax
$ bin/cassandra
Note
When Cassandra loads, you may notice a message that MX4J will not load and that mx4j-tools.jar is not in the classpath. You can ignore this message. MX4j provides an HTML and HTTP interface to JMX and is not necessary to run Cassandra. DataStax recommends using OpsCenter. It has more monitoring capabilities than MX4J.
Check that Cassandra is running by invoking the nodetool utility from the installation home directory:
$ bin/nodetool ring -h localhost