Setting up the cycling keyspace
CQL commands to set up the cycling
keyspace for examples used in this documenation.
Use the replication factor that is appropriate for your environment. The following assumes that the Cassandra deployment is a single node cluster in a development environment.
Update the following command and create a CQL file named keyspace-create-simple.cql
in the same directory where you launch cqlsh
.
CREATE KEYSPACE IF NOT EXISTS cycling WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
Additional cycling keyspace examples
Create a keyspace with a network topology strategy
CREATE KEYSPACE cycling
WITH REPLICATION = {
'class' : 'NetworkTopologyStrategy',
'datacenter1' : 1
};
Create a keyspace with multiple data centers
CREATE KEYSPACE IF NOT EXISTS cycling
WITH REPLICATION = {
'class' : 'NetworkTopologyStrategy',
'datacenter1': '3',
'datacenter2': '3'
};
Create a keyspace with multiple named data centers
-- previously tag::multi
// tag::keyspace-create-Cycling[]
CREATE KEYSPACE "Cycling"
WITH REPLICATION = {
'class' : 'NetworkTopologyStrategy',
'boston' : 3 , // Datacenter 1
'seattle' : 2 , // Datacenter 2
'tokyo' : 2 // Datacenter 3
};
// end::keyspace-create-Cycling[]
Create a keyspace with keyspace options
CREATE KEYSPACE cycling
WITH REPLICATION = {
'class' : 'NetworkTopologyStrategy',
'datacenter1' : 3
}
AND DURABLE_WRITES = false;