About keyspaces

Top level database object that contains tables, materialized views, user-defined types, functions, and aggregates and controls the data replication factor.

A keyspace is the top level database object that controls the replication for the object it contains at each datacenter in the cluster. Keyspaces contain tables, materialized views and user-defined types, functions and aggregates. Typically, a cluster has one keyspace per application. Since replication is controlled on a per-keyspace basis, store data with different replication requirements (at the same datacenter) in different keyspaces. Keyspaces are not a significant map layer within the data model.

Replication strategy and factor

When you create or modify a keyspace, specify a Table 2 for replicating keyspaces.

  • SimpleStrategy class is for evaluating DataStax Enterprise. For production use or for use with mixed workloads, use the NetworkTopologyStrategy class.
  • NetworkTopologyStrategy class is for production use.
    Note: You can also use NetworkTopologyStrategy for evaluation purposes by changing the default snitch, SimpleSnitch, to a network-aware snitch. Choose a snitch and define one or more datacenter names in the snitch properties file, and then use the datacenter name(s) to set the keyspace replication factor. For example, if the cluster uses the GossipingPropertyFileSnitch, create the keyspace using the user-defined datacenter and rack names in the cassandra-rackdc.properties file. If the cluster uses the Ec2Snitch, create the keyspace using EC2 datacenter and rack names. If the cluster uses the GoogleCloudSnitch, create the keyspace using GoogleCloud datacenter and rack names.
    The location of the cassandra-rackdc.properties file depends on the type of installation:

    Package installations
    Installer-Services installations

    /etc/dse/cassandra/cassandra-rackdc.properties

    Tarball installations
    Installer-No Services installations

    install_location/resources/cassandra/conf/cassandra-rackdc.properties
  • EveryWhereStrategy is a specialized DataStax Enterprise strategy used by the dse_system keyspace and is not intended for customer use.

Showing the keyspace details

In cqlsh, the DESCRIBE KEYSPACE command outputs the full details of the keyspace, including all database objects the keyspace contains. Use the output from the DESCRIBE command to recreate the keyspace and all its components.

CAUTION:
The output includes all settings for tables and other objects including the default settings. When recreating a keyspace in another environment, verify that the settings are compatible, such as the keyspace replication factor datacenter names.

Errors related to the SimpleSnitch

When the default snitch, SimpleSnitch, is used with NetworkTopologyStrategy, write request, such as inserting data into a table, may fail with the following error message:
Unable to complete request: one or more nodes were unavailable.