Add nodes to a cluster on Amazon EC2.
As a best practice when expanding a cluster, DataStax recommends doubling the size of the cluster size with each expansion. You should calculate the node number and token for each node based on the final ring size. For example, suppose that you ultimately want a 12 node cluster, starting with three node cluster. The initial three nodes are 0, 4, and 8. For the first expansion, you double the number of nodes to six by adding nodes, 2, 6, and 10. For the final expansion, you add six more nodes: 1, 3, 5, 7, 9, and 11. Using the tokengentool, calculate tokens for 12 nodes and enter the corresponding values in the initial_token property in the cassandra.yaml file. Adding Capacity to an Existing Cluster provides additional information about adding nodes and data centers.
If you want an EC2 cluster that spans multiple regions and availability zones, do not use the DataStax AMI. Instead, install DataStax Enterprise on your EC2 instances as described in Installing the DataStax Enterprise Package on Debian and Ubuntu, and then configure the cluster as a multiple data center cluster.
In the AWS Management Console, create the number of nodes you need in another cluster with a temporary name. See Initializing a DataStax Enterprise Cluster on Amazon EC2.
The temporary name prevents the new nodes from joining the cluster with the wrong tokens.
After the nodes have initialized, login to each node and stop the service:
sudo service dse stop
Clear the data in each node:
sudo rm -rf /var/lib/cassandra/*
You must clear the data because new nodes have existing data from the initial start with the temporary cluster name and token.
For each node, change the /etc/dse/cassandra/cassandra.yaml settings to match the cluster_name and - seeds list of the other cluster. For example:
cluster_name: 'NameOfExistingCluster' ... initial_token: 28356863910078205288614550619314017621 ... seed_provider: - class_name: org.apache.cassandra.locator.SimpleSeedProvider parameters: - seeds: "188.8.131.52,184.108.40.206"
Assign the correct initital_token to each node; it determines the node's placement within the ring.
Start each node in two minute intervals:
sudo service dse start
Verify that each node has finished joining the ring:
nodetool -h <hostname> ring
Each node should show Up not Joining.