CQL for Cassandra 1.2

ALTER KEYSPACE

Change property values of a keyspace.

Synopsis

        ALTER KEYSPACE | SCHEMA keyspace_name
  WITH REPLICATION = map
  | WITH DURABLE_WRITES = true | false
        AND DURABLE_WRITES = true
        |
        false
      

map is a map collection:

{ property : value, property, value : property, value ... }

Synopsis legend

  • Uppercase means literal
  • Lowercase means not literal
  • Italics mean optional
  • The pipe (|) symbol means OR or AND/OR
  • Ellipsis (...) means repeatable
  • « means a non-literal, open parenthesis used to indicate scope
  • » means a non-literal, close parenthesis used to indicate scope

A semicolon that terminates CQL statements is not included in the synopsis.

Description

ALTER KEYSPACE changes the map that defines the replica placement strategy and/or the durable_writes value. You can also use the alias ALTER SCHEMA. Use these properties and values to construct the map. To set the replica placement strategy, construct a map of properties and values, as shown in the table of map properties on the CREATE KEYSPACE reference page.

You cannot change the name of the keyspace.

Example

Continuing with the example in CREATE KEYSPACE, change the definition of the Excalibur keyspace to use the SimpleStrategy and a replication factor of 3.

ALTER KEYSPACE "Excalibur" WITH REPLICATION =
  { 'class' : 'SimpleStrategy', 'replication_factor' : 3 };
Show/hide