Creating a healthcare keyspace for tutorials
Step-by-step instructions to create a keyspace for tutorials found in this section.
Step-by-step instructions to create a keyspace for tutorials found in this section.
Procedure
-
Get a list of datacenter names (DC) in the cluster.
dsetool status
The header line contains the datacenter name (DC: datacenter_name) and the type of workload.
DC: Cassandra Workload: Cassandra Graph: no ====================================================== ... DC: Solr Workload: Search Graph: no ====================================================== ...
-
Start a cqlsh session:
cqlsh
Tip: To connect cqlsh to a remote node use the host switch with the hostname or IP address. -
Create a healthcare keyspace with a replication factor of 1 in each
datacenter.
This example is for a multi-datacenter environment, in which case you specify a
NetworkTopologyStrategy
and set the replication factor for each datacenter to at least one.CREATE KEYSPACE IF NOT EXISTS healthcare WITH replication = { 'class': 'NetworkTopologyStrategy', 'Cassandra': '1', 'Solr': '1'};
If you are creating a keyspace on a single datacenter environment, you can instead use a command such as in this example:CREATE KEYSPACE IF NOT EXISTS healthcare WITH replication = {'class': 'SimpleStrategy', 'replication_factor':1};
Note: Datacenter names are case-sensitive. Exit cqlsh and ensure that the name exactly matches the DC name from thedsetool status
output.