Apache Cassandra 1.0 Documentation

Installing a Single-Node Instance of Cassandra

The best way to get up and running quickly with Cassandra is to install Cassandra using the DataStax Community tarball distributions and start a single-node instance. Cassandra is intended to be run on multiple nodes. However, starting out with a single-node cluster is a great way to get started.

Note

The instructions in the following sections for a quick start tutorial, not production installations. See Planning a Cassandra Cluster Deployment, Installing and Initializing a Cassandra Cluster, and Configuring and Starting a Cassandra Cluster for production cluster setup best practices.

Getting up and running is simple:

  1. Make sure you have Java installed.
  2. Install the DataStax Community Edition of Apache Cassandra that suits your needs:

Checking for a Java Installation

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 instance, any JVM is fine.

To check for Java, run the following command in a terminal session:

$ java -version

If you do not have Java installed, see Installing the JRE on RHEL or CentOS Systems or Installing the JRE on Debian or Ubuntu Systems for instructions.

Installing the DataStax Community Binaries on Linux or Mac OSX Using sudo

The quickest way to get going on a single node with Cassandra is to install the DataStax Community Edition binary tarball packages using root permissions (or sudo). This installation also creates files and directories in /var/lib/cassandra and /var/log/cassandra. If you need to install everything in a single location, such as your home directory, and without root permissions, see Installing the DataStax Community Binaries Not Using sudo.

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 website.

  1. Download the Cassandra package (required), and the optional OpsCenter:

    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. Start the Cassandra server in the background from the directory where the package was installed. For example, if dsc-cassandra-1.0.9 is installed in your home directory:

    $ cd ~/dsc-cassandra-1.0.9
    $ sudo 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.

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

    bin/nodetool ring –h localhost
    

    ../../_images/get_start_nodetoolring.png

Next Steps

  • Install the DataStax OpsCenter. The OpsCenter is a browser-based application for managing and monitoring a Cassandra cluster. See the Installing the OpsCenter.
  • Run the Portfolio Demo example application.

Stopping the Cassandra server

To stop the Cassandra server:

$ ps -ef | grep opscenter
$ sudo kill 1259

Installing the DataStax Community Binaries Not Using sudo

This section provides instructions for installing and setting up a self-contained, single-node instance of Cassandra in your home directory that does not require root permissions.

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 downloaded directory to datastax:

    $ mv dsc-cassandra-1.0.9 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
    

Configuring and Starting the Cluster

In this section, you set the configuration properties needed to run Cassandra as a single-node cluster on the localhost from your home directory. These properties are specified in the cassandra.yaml and log4j-server.properties files.

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

    $ cd ~/datastax/conf
    
  2. Edit the following lines in cassandra.yaml:

    initial_token: 0
    data_file_directories: - ~/datastax/cassandra-data/data
    commitlog_directory: ~/datastax/cassandra-data/commitlog
    saved_caches_directory: ~/datastax/cassandra-data/saved_caches
    
  3. In the conf directory, change the log4j-server.properties file:

    log4j.appender.R.File= ~/datastax/cassandra-data/system.log
    
  4. Start the Cassandra server in the background.

    $ cd ~/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
    

    The nodetool ring command displays the running instance of Cassandra, as shown above.

Next Steps

  • Install the DataStax OpsCenter. The OpsCenter is a browser-based application for managing and monitoring a Cassandra cluster. See the Installing the OpsCenter.
  • Run the Portfolio Demo example application.

Stopping the Cassandra server

To stop the Cassandra server:

$ ps -ef | grep cassandra
$ kill 1259

Installing the DataStax Community Binaries on Windows

DataStax provides a GUI installer for installing both Cassandra and OpsCenter on Windows. Download the Windows installer for your chosen platform (32- or 64-bit Windows 7 or Windows Server 2008) from DataStax Downloads. Then follow the installation wizard to install Cassandra, the sample applications, and OpsCenter. This install starts

Prerequisite

Before installing OpsCenter on a single node make sure you have met the following prerequisite:

Starting Services

During installation, accept the options to start the DataStax Cassandra Server and OpsCenter services automatically.

When you select to start services, the Cassandra server, the OpsCenter server, and the OpsCenter agent start automatically when the installation completes (and whenever the computer reboots).

Launching Cassandra Server and OpsCenter

To finish installing DataStax Community Edition, accept the option to launch immediately.

To launch OpsCenter at a later time, enter the following URL in a browser:

http://localhost:8888/opscenter

Troubleshooting OpsCenter Windows Installations

Problems starting up OpsCenter and delays in stopping the OpsCenter Agent service are easily solved.

OpsCenter does not start up:

If OpsCenter does not start up when you enter the URL to launch it, the most likely reasons are:

  • DataStax services are not running:

    Solution: Check that the Cassandra and OpsCenter services are running. If not, start them in the Control Panel.


    ../../_images/install_opsc_startsvcs.png
  • Microsoft Visual C++ 2008 Redistributable Package is not installed:

    Solution: Check that this package is installed. If not, download and install the package from Microsoft for 32- and 64-bit systems.

Stopping the OpsCenter Agent service takes a long time:

Be patient. Manually stopping the OpsCenter Agent service takes time.
Powered by Rackspace
Apache, Apache Cassandra, Cassandra, Apache Hadoop, Hadoop and the eye logo are trademarks of the Apache Software Foundation.