Apache Cassandra 0.7 Documentation

Keyspaces

This document corresponds to an earlier product version. Make sure you are using the version that corresponds to your version.

Latest Cassandra documentation | Earlier Cassandra documentation

Keyspaces group column families together. Typically, there will be one Keyspace for each application that uses a Cassandra cluster. The most important settings that are defined at the keyspace level are the replication factor and the replica placement strategy. Thus, if you have sets of data that have different requirements for these settings (such as different levels of fault-tolerance), these sets of data should reside in different keyspaces.

A increase in the number of keyspaces does not inherently have a performance impact on Cassandra (although the number of column families does). With that said, keyspaces are not designed to be used as a significant “map” layer in the data model, only as a way to control data replication for a set of column families.

Example Keyspace

You can create an example keyspace using a script provided in conf/schema-sample.txt. To create the example keyspace Keyspace1, run the following command in the Cassandra CLI:

bin/cassandra-cli -host localhost --file conf/schema-sample1.txt

The column family definitions and other commands used can be viewed schema-sample.txt, or, after creating the example keyspace, by the CLI command show keyspaces. For more information on using the CLI, see Using the Cassandra CLI.