Creating a demo 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 demo keyspace with a replication factor of 1 in each datacenter.

    In multi-datacenter environments use NetworkTopologyStrategy and set the replication factor for each datacenter to at least one.

    CREATE KEYSPACE demo
    WITH REPLICATION = {
        'class': 'NetworkTopologyStrategy',
        'Cassandra': '1',
        'Solr': '1'};

    Datacenter names are case-sensitive.

Exit cqlsh and ensure that the name exactly matches the DC name from the nodetool 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