Initializing single-token architecture datacenters

Deploy a single-token datacenter when not using virtual nodes (vnodes).

Follow these steps only when not using virtual nodes (vnodes).

In most circumstances, each workload type, such as search, analytics, and transactional, should be organized into separate virtual datacenters. Workload segregation avoids contention for resources. However, workloads can be combined in SearchAnalytics nodes when there is not a large demand for analytics, or when analytics queries must use a DSE Search index. Generally, combining transactional (OLTP) and analytics (OLAP) workloads results in decreased performance.

When creating a keyspace using CQL, DataStax Enterprise creates a virtual datacenter for a cluster, even a one-node cluster, automatically. You assign nodes that run the same type of workload to the same datacenter. The separate, virtual datacenters for different types of nodes segregate workloads that run DSE Search from those nodes that run other workload types.

cassandra.yaml

The location of the cassandra.yaml file depends on the type of installation:
Package installations /etc/dse/cassandra/cassandra.yaml
Tarball installations installation_location/resources/cassandra/conf/cassandra.yaml

cassandra-topology.properties

The location of the cassandra-topology.properties file depends on the type of installation:
Package installations /etc/dse/cassandra/cassandra-topology.properties
Tarball installation installation_location/resources/cassandra/conf/cassandra-topology.properties

dse.yaml

The location of the dse.yaml file depends on the type of installation:
Package installations /etc/dse/dse.yaml
Tarball installations installation_location/resources/dse/conf/dse.yaml

cassandra-rackdc.properties

The location of the cassandra-rackdc.properties file depends on the type of installation:
Package installations /etc/dse/cassandra/cassandra-rackdc.properties
Tarball installations installation_location/resources/cassandra/conf/cassandra-rackdc.properties

Prerequisites

Important: Complete the tasks outlined in Initializing a DataStax Enterprise cluster to prepare the environment.

Procedure

These steps provide information about setting up a cluster having one or more datacenters.
  1. Suppose you install DataStax Enterprise on these nodes:
    • node0 10.168.66.41 (seed1)
    • node1 10.176.43.66
    • node2 10.168.247.41
    • node3 10.176.170.59 (seed2)
    • node4 10.169.61.170
    • node5 10.169.30.138
  2. Calculate the token assignments as described in Calculating tokens for single-token architecture nodes.

    The following tables list tokens for a 6 node cluster with a single datacenter or two datacenters.

    Table 1. Single Datacenter
    Node Token
    node0 0
    node1 21267647932558653966460912964485513216
    node2 42535295865117307932921825928971026432
    node3 63802943797675961899382738893456539648
    node4 85070591730234615865843651857942052864
    node5 106338239662793269832304564822427566080
    Table 2. Multiple Datacenters
    Node Token Offset Datacenter
    node0 0 NA DC1
    node1 56713727820156410577229101238628035242 NA DC1
    node2 113427455640312821154458202477256070485 NA DC1
    node3 100 100 DC2
    node4 56713727820156410577229101238628035342 100 DC2
    node5 113427455640312821154458202477256070585 100 DC2
  3. If the nodes are behind a firewall, open the required ports for internal/external communication.
  4. If DataStax Enterprise is running, stop the node and clear the data:
    • Package installations: To stop DSE:
      sudo service dse stop
      To remove data from the default directories:
      sudo rm -rf /var/lib/cassandra/*
    • Tarball installations:
      From the installation location, stop the database:
      bin/dse cassandra-stop
      Remove all data:
      cd /var/lib/cassandra/data &&
      sudo rm -rf data/* commitlog/* saved_caches/* hints/* 
  5. Configure properties in cassandra.yaml on each new node, following the configuration of the other nodes in the cluster.
    Tip: Use the yaml_diff tool to review and make appropriate changes to the cassandra.yaml and dse.yaml configuration files.
    1. Configure node properties.
  6. Set the properties in the dse.yaml file as required by your use case.
  7. In the cassandra-rackdc.properties (GossipingPropertyFileSnitch) or cassandra-topology.properties (PropertyFileSnitch) file, assign datacenter and rack names to the IP addresses of each node, and assign a default datacenter name and rack name for unknown nodes.
    Note: Migration information: The GossipingPropertyFileSnitch always loads cassandra-topology.properties when the file is present. Remove the file from each node on any new cluster, or any cluster migrated from the PropertyFileSnitch.
    # Transactional Node IP=Datacenter:Rack
    110.82.155.0=DC_Transactional:RAC1
    110.82.155.1=DC_Transactional:RAC1
    110.54.125.1=DC_Transactional:RAC2
    110.54.125.2=DC_Analytics:RAC1
    110.54.155.2=DC_Analytics:RAC2
    110.82.155.3=DC_Analytics:RAC1
    110.54.125.3=DC_Search:RAC1
    110.82.155.4=DC_Search:RAC2
    
    # default for unknown nodes
    default=DC1:RAC1
    Note: After making any changes in the configuration files, you must the restart the node for the changes to take effect.
  8. After you have installed and configured DataStax Enterprise on all nodes, start the seed nodes one at a time, and then start the rest of the nodes:
  9. Check that your cluster is up and running:
    dsetool status
    Note: If DSE has problems starting, look for starting DSE troubleshooting and other articles in the Support Knowledge Center.

Results

Datacenter: Cassandra
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address         Load        Tokens    Owns    Host ID             Rack
UN 110.82.155.0    21.33 KB    256       33.3%   a9fa31c7-f3c0-...   RAC1
UN 110.82.155.1    21.33 KB    256       33.3%   f5bb416c-db51-...   RAC1
UN 110.82.155.2    21.33 KB    256       16.7%   b836748f-c94f-...   RAC1