Apache Cassandra 1.1 Documentation

Installing the DataStax Community Binaries on Linux or Mac as User

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.

Prerequisites

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.

Steps to Install Cassandra

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.

  1. 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
    
  2. Unpack the distributions:

    $ tar -xzvf dsc.tar.gz
    $ tar -xzvf opscenter.tar.gz
    $ rm *.tar.gz
    
  3. Rename the untarred directory to datastax:

    $ mv dsc-cassandra-1.1.x datastax
    
  4. In the datastax directory, create the data and logging directory for Cassandra.

    $ cd datastax
    $ mkdir cassandra-data
    
  5. In cassandra-data, create the following directories: saved_caches and commitlog.

    $ cd cassandra-data
    $ mkdir data
    $ mkdir saved_caches
    $ mkdir commitlog
    

Steps to Configure and Start the Cluster

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.

  1. Go the directory containing the cassandra.yaml file:

    $ cd <USER_HOME>/datastax/conf
    
  2. 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
    
  3. In the conf directory, change the log4j-server.properties file:

    log4j.appender.R.File= <USER_HOME>/datastax/cassandra-data/system.log
    
  4. 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.

  5. Check that Cassandra is running by invoking the nodetool utility from the installation home directory:

    $ bin/nodetool ring -h localhost
    

    ../../_images/get_start_nodetoolring_nosudo.png

Next Steps