Creating a healthcare keyspace for tutorials

Step-by-step instructions to create a keyspace for tutorials found in this section.

Procedure

  1. 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
    ======================================================
    ...
  2. Start a cqlsh session:

    cqlsh

    To connect cqlsh to a remote node use the host switch with the hostname or IP address.

  3. 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};

    Datacenter names are case-sensitive. Exit cqlsh and ensure that the name exactly matches the DC name from the dsetool status output.

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com