Single-token architecture deployment

Steps for deploying when you are not using virtual nodes (vnodes).

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

Prerequisites

  • Have a basic understanding of tokens and Database internals.
  • Ensure DataStax Enterprise is installed on each node.
  • Choose a name for the cluster.
  • Take note of the total number of nodes in the cluster.
  • For a mixed-workload cluster, determine the purpose of each node.
  • Determine which nodes are seed nodes. Do not make all nodes seed nodes. Seed nodes are not required for DSE Search datacenters. Read Internode communications (gossip).
  • If using multiple data centers, develop a naming convention for each data center and rack, for example: DC1, DC2 or 100, 200 and RAC1, RAC2 or R101, R102.
  • Use the yaml_diff tool to review and make appropriate changes to the cassandra.yaml configuration file.
    The location of the cassandra.yaml file depends on the type of installation:
    Package installations /etc/dse/cassandra/cassandra.yaml
    Tarball installations install_location/resources/cassandra/conf/cassandra.yaml

Procedure

  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 using the information on Calculating tokens for single-token architecture nodes.
    Single Data Center
    Node Token
    node0 0
    node1 21267647932558653966460912964485513216
    node2 42535295865117307932921825928971026432
    node3 63802943797675961899382738893456539648
    node4 85070591730234615865843651857942052864
    node5 106338239662793269832304564822427566080
    Multiple Data Centers
    Node Token Offset Data Center
    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. See Configuring firewall port access.
  4. If DataStax Enterprise is running, stop the nodes and clear the data:
    • Installer-Services and Package installations:
      $ sudo service dse stop
      $ sudo rm -rf /var/lib/cassandra/*  # Clears the data from the default directories
    • Installer-No Services and Tarball installations:

      From the install directory:

      $ sudo bin/dse cassandra-stop
      $ sudo rm -rf /var/lib/cassandra/*  # Clears the data from the default directories 
      Note: If you are clearing data from an AMI installation for restart, you need to preserve the log files.
  5. Set the properties in the cassandra.yaml file for each node.
    The location of the cassandra.yaml file depends on the type of installation:
    Package installations /etc/dse/cassandra/cassandra.yaml
    Tarball installations install_location/resources/cassandra/conf/cassandra.yaml
    Important: After making any changes in cassandra.yaml, you must restart the node for the changes to take effect.

    Properties to set:

    • initial_token: token
    • num_tokens: 1
    • -seeds: internal_IP_address of each seed node
    • listen_address: empty

      If not set, Cassandra asks the system for the local address, the one associated with its hostname. In some cases Cassandra doesn't produce the correct address and you must specify the list_address.

    • endpoint_snitch: snitch

      For more information, see About Snitches.

    • auto_bootstrap: false

      Add the bootstrap setting only when initializing a fresh cluster with no data.

    • If you are using a cassandra.yaml from a previous version, remove the following options, as they are no longer supported by DataStax Enterprise:
      ## Replication strategy to use for the auth keyspace.
      auth_replication_strategy: org.apache.cassandra.locator.SimpleStrategy
      
      auth_replication_options:
          replication_factor: 1

    Example:

    If using more than one data center, include at least one seed node from each data center. It is a best practice to have more than one seed node per data center.

    cluster_name: 'MyDemoCluster'
    num_tokens: 256
    seed_provider:
      - class_name: org.apache.cassandra.locator.SimpleSeedProvider
        parameters:
             - seeds: "10.168.66.41,10.176.170.59"
    listen_address:
  6. In the cassandra-topology.properties file, use your naming convention to assign data center and rack names to the IP addresses of each node, and assign a default data center name and rack name for unknown nodes.
    The default location of the cassandra-topology.properties file depends on the type of installation:
    Installer-Services and Package installations /etc/dse/cassandra/cassandra-topology.properties
    Installer-No Services and Tarball installations install_location/resources/cassandra/conf/cassandra-topology.properties

    Example:

    # Cassandra Node IP=Data Center:Rack
    10.168.66.41=DC1:RAC1
    10.176.43.66=DC2:RAC1
    10.168.247.41=DC1:RAC1
    10.176.170.59=DC2:RAC1
    10.169.61.170=DC1:RAC1
    10.169.30.138=DC2:RAC1
    
    # default for unknown nodes
    default=DC1:RAC1
  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:
    Note: If the node has restarted because of automatic restart, you must stop the node and clear the data directories, as described above.
  8. Check that your cluster is up and running:
    • Installer-Services and Package installations: $ nodetool status
    • Installer-No Services and Tarball installations: $ install_location/bin/nodetool status