Initializing multiple datacenters per workload type

Configure nodes in a mixed-workload cluster that has more than one datacenter for each type of node.

In this scenario, a mixed workload cluster has more than one datacenter for each type of workload. For example, the following ten-node cluster is spans five datacenters, whereas a single datacenter cluster has only one datacenter for each node type.
  • DC1 = 2 DSE Analytics nodes
  • DC2 = 2 Transactional nodes
  • DC3 = 2 DSE Search nodes
  • DC4 = 2 DSE Analytics nodes
  • DC5 = 2 Transactional nodes

The ten-node cluster spans two racks across five datacenters. Applications in each datacenter will use a default consistency level of LOCAL_QUORUM. One node per rack will serve as a seed node.

Node IP address Type Seed
node0 110.82.155.0 Transactional RAC1
node1 110.82.155.1 Transactional RAC1
node2 110.54.125.1 Transactional RAC2
node3 110.55.120.1 Transactional RAC1
node4 110.54.125.2 Analytics RAC1
node5 110.54.155.2 Analytics RAC2
node6 110.82.155.3 Analytics RAC1
node7 110.55.120.2 Analytics RAC1
node8 110.54.125.3 Search RAC1
node9 110.82.155.4 Search RAC2

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

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

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 prerequisite tasks outlined in Initializing a DataStax Enterprise cluster to prepare the environment.
If the new datacenter uses existing nodes from another datacenter or cluster, complete the following steps to ensure that old data will not interfere with the new cluster:
  1. If the nodes are behind a firewall, open the required ports for internal/external communication.
  2. Decommission each node that will be added to the new datacenter.
  3. Clear the data from DataStax Enterprise (DSE) to completely remove application directories.
  4. Install DSE on each node. Do not start the service.

Procedure

  1. Complete the following steps to prevent client applications from prematurely connecting to the new datacenter, and to ensure that the consistency level for reads or writes does not query the new datacenter:
    Warning: If client applications, including DSE Search and DSE Analytics, are not properly configured, they might connect to the new datacenter before it is online. Incorrect configuration results in connection exceptions, timeouts, and/or inconsistent data.
    1. Configure client applications to use the DCAwareRoundRobinPolicy.
    2. Direct clients to an existing datacenter. Otherwise, clients might try to access the new datacenter, which might not have any data.
    3. If using the QUORUM consistency level, change to LOCAL_QUORUM.
    4. If using the ONE consistency level, set to LOCAL_ONE.

    See the programming instructions for your driver.

  2. In existing datacenters, if the SimpleStrategy replication strategy is in use, change it to the NetworkTopologyStrategy replication strategy.
    1. Use ALTER KEYSPACE to change the keyspace replication strategy to NetworkTopologyStrategy for the following keyspaces.
      ALTER KEYSPACE keyspace_name WITH REPLICATION = 
      {'class' : 'NetworkTopologyStrategy', 'DC1' : 3};
      • DSE security: system_auth, dse_security
      • DSE performance: dse_perf
      • DSE analytics: dse_leases, dsefs
      • System resources: system_traces, system_distributed
      • OpsCenter (if installed)
      • All keyspaces created by users
    2. Use DESCRIBE SCHEMA to check the replication strategy of keyspaces in the cluster. Ensure that any existing keyspaces use the NetworkTopologyStrategy replication strategy.
      DESCRIBE SCHEMA ;
      CREATE KEYSPACE dse_perf WITH replication = 
      {'class': 'NetworkTopologyStrategy, 'DC1': '3'}  AND durable_writes = true;
      ...
      
      CREATE KEYSPACE dse_leases WITH replication =
      {'class': 'NetworkTopologyStrategy, 'DC1': '3'}  AND durable_writes = true;
      ...
      
      CREATE KEYSPACE dsefs WITH replication =
      {'class': 'NetworkTopologyStrategy, 'DC1': '3'}  AND durable_writes = true;
      ...
      
      CREATE KEYSPACE dse_security WITH replication =
      {'class': 'NetworkTopologyStrategy, 'DC1': '3'}  AND durable_writes = true;
  3. Install DSE on each node in the new datacenter, install DSE. Do not start the service or restart the node.
    Important: Use the same version of DSE on all nodes in the cluster.
  4. 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:
      • -seeds: internal_IP_address of each seed node
        Important: Include at least one seed node from each datacenter. DataStax recommends more than one seed node per datacenter, in more than one rack. 3 is the most common number of seed nodes per datacenter. Do not make all nodes seed nodes.
      • auto_bootstrap: true

        This setting has been removed from the default configuration, but, if present, should be set to true.

      • listen_address: empty

        If not set, DSE asks the system for the local address, which is associated with its host name. In some cases, DSE does not produce the correct address, which requires specifying the listen_address.

      • endpoint_snitch: snitch

        See endpoint_snitch and snitches.

        Important: Do not use the DseSimpleSnitch. The DseSimpleSnitch (default) is used only for single-datacenter deployments (or single-zone deployments in public clouds), and does not recognize datacenter or rack information.
        Snitch Configuration file
        GossipingPropertyFileSnitch cassandra-rackdc.properties file
        Amazon EC2 single-region snitch
        Amazon EC2 multi-region snitch
        Google Cloud Platform snitch
        cassandra-topology.properties file
      • If using a cassandra.yaml or dse.yaml file from a previous version, check the Upgrade Guide for removed settings.
    2. Configure node architecture (all nodes in the datacenter must use the same type):

      Virtual node (vnode) allocation algorithm settings

      Note: See Virtual node (vnode) configuration for more details.

      Single-token architecture settings

  5. 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 datacenter, or any datacenter 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.
  6. Make the following changes in the existing datacenters.
    1. On nodes in the existing datacenters, update the -seeds property in cassandra.yaml to include the seed nodes in the new datacenter.
    2. Add the new datacenter definition to the cassandra.yaml properties file for the type of snitch used in the cluster. If changing snitches, see Switching snitches.
  7. 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:
  8. Rotate starting DSE through the racks until all the nodes are up.
  9. After all nodes are running in the cluster and the client applications are datacenter aware, use cqlsh to alter the keyspaces to add the desired replication in the new datacenter.
    ALTER KEYSPACE keyspace_name WITH REPLICATION = 
    {'class' : 'NetworkTopologyStrategy', 'ExistingDC1' : 3, 'NewDC2' : 2};
    Warning: If client applications, including DSE Search and DSE Analytics, are not properly configured, they might connect to the new datacenter before it is online. Incorrect configuration results in connection exceptions, timeouts, and/or inconsistent data.
  10. Run nodetool rebuild on each node in the new datacenter, specifying the datacenter to rebuild from. This step replicates the data to the new datacenter in the cluster.
    nodetool rebuild -- datacenter_name
    CAUTION: You must specify an existing datacenter in the command line, or the new nodes will appear to rebuild successfully, but might not contain all anticipated data.

    Requests to the new datacenter with LOCAL_ONE or ONE consistency levels can fail if the existing datacenters are not completely in-sync.

    1. Use nodetool rebuild on one or more nodes at the same time. Run on one node at a time to reduce the impact on the existing cluster.
    2. Alternatively, run the command on multiple nodes simultaneously when the cluster can handle the extra I/O and network pressure.
  11. Check that the new 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.
  12. Complete 3 through 11 to add the remaining datacenters to the cluster.

Results

The datacenters in the cluster are now replicating with each other.
DC: Cassandra   Workload: Cassandra  Graph: no
==============================================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address         Load        Tokens    Owns    Host ID             Rack
UN 110.82.155.0    21.33 KB    256       50.2%   a9fa31c7-f3c0-...   RAC1
UN 110.82.155.1    21.33 KB    256       49.8%   f5bb416c-db51-...   RAC1

DC: Analytics
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address         Load        Owns      Host ID               Tokens         Rack
UN 110.54.125.2    28.44 KB    50.2.%    e2451cdf-f070- ...    -922337....    RAC1
UN 110.82.155.2    44.47 KB    49.8%     f9fa427c-a2c5- ...    30745512...    RAC2 

DC: Solr 
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address         Load        Owns      Host ID               Tokens         Rack
UN 110.54.125.3    15.44 KB    50.2.%    e2451cdf-f070- ...    9243578....    RAC1
UN 110.82.155.4    18.78 KB    49.8.%    e2451cdf-f070- ...    10000          RAC2

DC: Cassandra2   Workload: Cassandra  Graph: no
==============================================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address         Load        Tokens    Owns    Host ID             Rack
UN 110.54.125.1    21.33 KB    256       16.7%   b836748f-c94f-...   RAC2
UN 110.55.120.1    21.33 KB    256       16.7%   b354798g-c94f-...   RAC2

DC: Analytics2
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address         Load        Owns      Host ID               Tokens         Rack
UN 110.82.155.3    54.33 KB    50.2%     b9fc31c7-3bc0- ..-    45674488...    RAC1
UN 110.55.120.2    54.33 KB    49.8%     b8gd45e4-3bc0- ..-    45674488...    RAC2

What's next