Jump to: navigation, search

Initializing Cassandra

Make sure you have installed and tested Cassandra before completing the procedures below.

Creating the Cassandra Keyspace

The procedures below describe how to create the Cassandra keyspace for the following scenarios:

  • Development—one Cassandra node (appropriate for a development or lab environment)
  • Single Datacenter—one datacenter with a minimum of three Cassandra nodes
  • Two Datacenters—two datacenters with a minimum of three Cassandra nodes in each datacenter
Important
For more complex Cassandra deployments, please consult with Genesys.

Select a tab below for the procedure that matches your deployment scenario.

Creating the Cassandra Keyspace (1 Cassandra Node)

Start


  1. Copy the ks-schema-local.cql file from installation_CD/data to the Cassandra node host.
  2. Set the replication factor to 1 (the default), if needed. Since this is a single node deployment, you don't need to modify this value. Refer to the Cassandra documentation for more information about replication factors.
    replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}
  3. Run the following command to create the Cassandra schema:
cassandra_install_dir/bin/cqlsh cassandra_host -f ks-schema-local.cql
...where cassandra_host is the host name (fully qualified domain name) or IP address of the Cassandra node.

End

Creating the Cassandra Keyspace (1 Datacenter)

Complete the following procedure on one node in your Cassandra cluster.

Start

  1. Copy the ks-schema-prod.cql file from installation_CD/data to the Cassandra node host.
  2. For fault tolerance, Genesys recommends that you use at least 3 Cassandra nodes and set the replication factor to 3. Refer to the Cassandra documentation for more information about replication factors. To modify this value, change the following line:
    replication = {'class': 'SimpleStrategy', 'replication_factor': '<replication-factor-in-your-environment>'}
  3. Run the following command to create the Cassandra schema:
cassandra_install_dir/bin/cqlsh cassandra_host -f ks-schema-prod.cql
…where cassandra_host is the host name (fully qualified domain name) or IP address of the Cassandra node.

End

Creating the Cassandra Keyspace (2 Datacenters)

Complete the following procedure on one node in your Cassandra cluster.

Start

  1. Copy the ks-schema-prod_HA.cql file from installation_CD/data to the Cassandra node host.
  2. Modify the following content:
    replication = {'class': 'NetworkTopologyStrategy', 'AZ1': '3', 'AZ2': '3'}
    1. Add the datacenter name. You can use nodetool to find the name of the datacenter by examining the output of nodetool status (the tool is located in the bin directory of Cassandra). The following is sample output from the nodetool:
    2. /genesys/apache-cassandra-2.2/bin$ ./nodetool status
      Datacenter: datacenter1
      =======================
      Status=Up/Down
      |/ State=Normal/Leaving/Joining/Moving
      --  Address     Load     Tokens  Owns (effective) \
      UN  192.0.2.10  4.58 MB  256     100.0%           \
      UN  192.0.2.11  2.3 MB   256     100.0%           \
      UN  192.0.2.12  4.11 MB  256     100.0%           \
                           Host ID                 Rack
            dab220f6-7744-4709-b2ce-d18629076a76   rack1
            922a3442-63f9-43f7-af08-2cd62f02e28b   rack1
            913f77c3-7dc2-4d93-b643-9e0c514314d1   rack1
      Datacenter: datacenter2
      =======================
      Status=Up/Down
      |/ State=Normal/Leaving/Joining/Moving
      --  Address        Load     Tokens   Owns (effective) \
      UN  198.51.100.10  4.16 MB   256      100.0%          \
      UN  198.51.100.11  2.24 MB   256      100.0%          \
      UN  198.51.100.12  4.19 MB   256      100.0%          \
                          Host ID                  Rack
            cd92c658-176a-453b-b118-9b952f78f237   rack1
            c4afbf92-59c8-450f-b9b1-79b3454c04a2   rack1
            d6fd07b4-8f6c-487e-a574-43d6f5980ac8   rack1
    3. Add the replication factor. Refer to the Cassandra documentation for more information about replication factors.

    Based on the nodetool output above, your line might be:

    replication = {'class': 'NetworkTopologyStrategy', 'datacenter1': '3', 'datacenter2': '3'}
  3. Run the following command to create the Cassandra schema:
cassandra_install_dir/bin/cqlsh cassandra_host -f ks-schema-prod_HA.cql
...where cassandra_host is the host name (fully qualified domain name) or IP address of the Cassandra node.

End

Creating the Column Families

Complete the following procedure on one node in your Cassandra cluster.

Start

  1. Copy the cf-schema.cql file from installation_CD/data to the Cassandra node host.
  2. Run the following command to create the Cassandra schema:
  3. cassandra_install_dir/bin/cqlsh cassandra_host -f cf-schema.cql
    ...where cassandra_host is the host name (fully qualified domain name) or IP address of the Cassandra node

End

Next Step

This page was last edited on July 2, 2018, at 10:56.
Comments or questions about this documentation? Contact us for support!