Changing keyspace strategy

Changing the strategy of a keyspace from SimpleStrategy to NetworkTopologyStrategy.

A keyspace is created with a strategy. For development work, the SimpleStrategy class is acceptable. For production work, the NetworkTopologyStrategy class must be set. To change the strategy, two steps are required.

Procedure

  • Change the snitch to a network-aware setting.
  • Alter the keyspace properties using the ALTER KEYSPACE command. For example, the keyspace cycling set to SimpleStrategy is switched to NetworkTopologyStrategy.
    ALTER KEYSPACE cycling 
    WITH REPLICATION = {
          'class' : 'NetworkTopologyStrategy', 
          'DC1' : 3, 
          'DC2' : 2 };
    Note: Datacenter names are case sensitive.