Setting up the Cycling keyspace

CQL commands to set up the cycling keyspace and examples used in this guide.

CQL commands to set up the cycling keyspace and examples used in this guide.

Use the replication factor that is appropriate for the type of snitch in your environment. The following assumes that the DataStax Enterprise deployment is a single node cluster in a development environment.

Update the following command and create a CQL file named 0_create_keyspace.cql in the same directory where you launch cqlsh.

// START-cyclingks
CREATE KEYSPACE IF NOT EXISTS cycling
WITH replication = {'class': 'SimpleStrategy', 'replication_factor':1};
// END-cyclingks

//START-usecycling
USE cycling;
//END-usecycling

Additional cycling keyspace examples

Shows additional keyspace examples
// START-single
CREATE KEYSPACE cycling
  WITH REPLICATION = { 
   'class' : 'SimpleStrategy', 
   'replication_factor' : 1 
  };
// END-single

// START-drop
DROP KEYSPACE cycling;
// END-drop

// START-network
CREATE KEYSPACE cycling 
  WITH REPLICATION = { 
   'class' : 'NetworkTopologyStrategy', 
   'datacenter1' : 1 } 
;
// END-network

DROP KEYSPACE cycling;

// START-multi
CREATE KEYSPACE "Cycling"
  WITH REPLICATION = {
   'class' : 'NetworkTopologyStrategy', 
   'boston'  : 3 , // Datacenter 1 
   'seattle' : 2 , // Datacenter 2
   'tokyo'   : 2   // Datacenter 3
  };
// END-multi

DROP KEYSPACE cycling;

// START-durable
CREATE KEYSPACE cycling
  WITH REPLICATION = { 
   'class' : 'NetworkTopologyStrategy',
   'datacenter1' : 3 
  } 
AND DURABLE_WRITES = false ;
// END-durable