Single data center deployment per workload type 

Steps for configuring nodes in a deployment scenario in a mixed workload cluster that has only one data center for each type of workload.

In this scenario, a mixed workload cluster has only one data center for each type of workload. For example, if the cluster has 3 analytics nodes, 3 Cassandra nodes, and 2 DSE Search nodes, the cluster has 3 data centers, one for each type of workload. In contrast, a multiple data-center cluster has more than one data center for each type of workload.

In Cassandra, a data center can be a physical data center or virtual data center. Different workloads must always use separate data centers, either physical or virtual. In a single data center deployment, data is replicated within its data center. For more information about replication:

Prerequisites

  • A good understanding of how Cassandra works. Be sure to read at least Understanding the architecture, Data Replication, and Cassandra's rack feature.
  • Ensure DataStax Enterprise is installed on each node.
  • Choose a name for the cluster.
  • For a mixed-workload cluster, determine the purpose of each node.
  • Determine the snitch and replication strategy. The GossipingPropertyFileSnitch and NetworkTopologyStrategy are recommended for production environments.
  • Get the IP address 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).
  • 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
  • Review and make appropriate changes to other property files, such as cassandra-rackdc.properties.
  • Set virtual nodes correctly for the type of data center. DataStax does not recommend using virtual nodes on data centers running BYOH or DSE Hadoop. See Virtual nodes.

Procedure

This configuration example describes installing an 8 node cluster spanning 2 racks in a single data center. The default consistency level is QUORUM.

  1. Suppose the nodes have the following IPs and one node per rack will serve as a seed:
    • node0 110.82.155.0 (Cassandra seed)
    • node1 110.82.155.1 (Cassandra)
    • node2 110.82.155.2 (Cassandra)
    • node3 110.82.155.3 (Analytics seed)
    • node4 110.82.155.4 (Analytics)
    • node5 110.82.155.5 (Analytics)
    • node6 110.82.155.6 (Search)
    • node7 110.82.155.7 (Search)
  2. If the nodes are behind a firewall, open the required ports for internal/external communication. See Configuring firewall port access.
  3. 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.
  4. Set the properties in the cassandra.yaml file for each node, located in:
    Important: After making any changes in cassandra.yaml, you must restart the node for the changes to take effect.

    If the nodes in the cluster are identical in terms of disk layout, shared libraries, and so on, you can use the same copy of the cassandra.yaml file on all of the nodes.

    Properties to set:

    • num_tokens: 256 for Cassandra nodes
    • num_tokens: 1 for Hadoop and DSE Search nodes
    • num_tokens: 64 to 256 for DSE Search nodes when using vnodes; otherwise 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 host name. In some cases Cassandra doesn't produce the correct address and you must specify the listen_address.

    • endpoint_snitch: snitch See endpoint_snitch. If you are changing snitches, see Switching snitches.
    • auto_bootstrap: false

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

    • endpoint_snitch: snitch

      For more information, see endpoint_snitch and About Snitches.

    • If you are using a cassandra.yaml file 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:

    cluster_name: 'MyDemoCluster'
    num_tokens: 256
    seed_provider:
      - class_name: org.apache.cassandra.locator.SimpleSeedProvider
        parameters:
             - seeds: "110.82.155.0,110.82.155.3"
    listen_address:
    endpoint_snitch: GossipingPropertyFileSnitch
  5. In the cassandra-rackdc.properties (GossipingPropertyFileSnitch) or cassandra-topology.properties (PropertyFileSnitch) 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
    The default location of the cassandra-rackdc.properties file depends on the type of installation:
    Installer-Services and Package installations /etc/dse/cassandra/cassandra-rackdc.properties
    Installer-No Services and Tarball installations install_location/resources/cassandra/conf/cassandra-rackdc.properties

    Example:

    # Cassandra Node IP=Data Center:Rack
    110.82.155.0=DC_Cassandra:RAC1
    110.82.155.1=DC_Cassandra:RAC1
    110.82.155.2=DC_Cassandra:RAC1
    110.82.155.3=DC_Analytics:RAC1
    110.82.155.4=DC_Analytics:RAC1
    110.82.155.5=DC_Analytics:RAC1
    110.82.155.6=DC_Solr:RAC1
    110.82.155.7=DC_Solr:RAC1
    
    # default for unknown nodes
    default=DC1:RAC1
  6. 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.
  7. 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

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
Datacenter: Analytics
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address         Load        Owns      Host ID               Tokens         Rack
UN 110.82.155.3    28.44 KB    13.0.%    e2451cdf-f070- ...    -922337....    RAC1
UN 110.82.155.4    44.47 KB    16.7%     f9fa427c-a2c5- ...    30745512...    RAC1 
UN 110.82.155.5    54.33 KB    23.6%     b9fc31c7-3bc0- ..-    45674488...    RAC1
Datacenter: Solr
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address         Load        Owns      Host ID               Tokens         Rack
UN 110.82.155.6    15.44 KB    50.2.%    e2451cdf-f070- ...    9243578....    RAC1
UN 110.82.155.7    18.78 KB    49.8.%    e2451cdf-f070- ...    10000          RAC1