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:
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.
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.
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
Unpack the distributions:
$ tar -xzvf dsc.tar.gz
$ tar -xzvf opscenter.tar.gz
$ rm *.tar.gz
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.
Check that Cassandra is running by invoking the nodetool utility from the installation home directory:
bin/nodetool ring –h localhost
To stop the Cassandra server:
$ ps -ef | grep opscenter $ sudo kill 1259
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.
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 downloaded directory to datastax:
$ mv dsc-cassandra-1.0.9 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
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.
Go the directory containing the cassandra.yaml file:
$ cd ~/datastax/conf
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
In the conf directory, change the log4j-server.properties file:
log4j.appender.R.File= ~/datastax/cassandra-data/system.log
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.
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.
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
Before installing OpsCenter on a single node make sure you have met the following prerequisite:
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).
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
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.
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.