This runbook describes the end-to-end procedure for adding a new node to an existing Apache Cassandra cluster.
Complete the sections in order: prepare and configure the new node, bring it online, confirm that it joined the cluster, and rebalance data on the pre-existing nodes.
Important: The new node configuration must match the existing Cassandra nodes. Before starting the node, compare
cassandra.yaml,cassandra-rackdc.properties,jvm.options, andcassandra-env.shwith a current cluster member and align every relevant setting. Only node-specific values, such aslisten_addressandbroadcast_rpc_address, should differ. Mismatched configuration is a common cause of a node failing to join.
In the examples below:
$INSTALL_DIR is the Cassandra installation directory.$clustername is the cluster name.$seedslist is the seed list.$dcname is the data center name.Set these values to match your environment before running the commands.
$INSTALL_DIR/cassandra/conf/
Edit cassandra.yaml on the new node so that its settings align with the rest of the cluster.
Set cluster_name to match the existing cluster name.
sed -i 's@cluster_name: .*@cluster_name: '$clustername'@' \
$INSTALL_DIR/cassandra/conf/cassandra.yaml
Specify the IP addresses or hostnames of at least a few existing cluster nodes in the seeds parameter. These seed nodes allow the new node to discover the existing cluster.
sed -i s/seeds:.*/"seeds: $seedslist"/g \
$INSTALL_DIR/cassandra/conf/cassandra.yaml
Set listen_address and broadcast_rpc_address to the new node's IP address.
sed -i s/listen_address:.*/"listen_address: $(hostname -I | awk '{print $1}')"/g \
$INSTALL_DIR/cassandra/conf/cassandra.yaml
sed -i s/broadcast_rpc_address:.*/"broadcast_rpc_address: $(hostname -I | awk '{print $1}')"/g \
$INSTALL_DIR/cassandra/conf/cassandra.yaml
Verify that the configured data directory paths match the other nodes in the cluster.
Verify that endpoint_snitch matches the existing cluster nodes.
If the cluster uses GossipingPropertyFileSnitch, for example:
sed -i 's@endpoint_snitch:.*@endpoint_snitch: GossipingPropertyFileSnitch@' \
$INSTALL_DIR/cassandra/conf/cassandra.yaml
Set the data center name in cassandra-rackdc.properties to match the cluster.
sed -i 's@dc=.*@dc='$dcname'@' \
$INSTALL_DIR/cassandra/conf/cassandra-rackdc.properties
Review jvm.options and ensure that it matches the other nodes in the cluster:
$INSTALL_DIR/cassandra/conf/
Review and modify cassandra-env.sh so that it matches the other nodes in the cluster:
$INSTALL_DIR/cassandra/conf/
Start the Cassandra service on the newly prepared node.
cassandra
Monitor the logs to ensure that the new node successfully joins the cluster.
From any existing node, run:
nodetool status
Confirm that the new node is listed and reports a status of UN (Up / Normal).
After the new node is Up / Normal, run nodetool cleanup on the older, pre-existing nodes to remove keys that no longer belong to them after token ranges have been rebalanced.
nodetool cleanup
Tip: Run cleanup one node at a time during a low-traffic window. Cleanup is I/O intensive and can temporarily affect performance.
This runbook describes the end-to-end procedure for adding a new node to an existing Apache Cassandra cluster.
Complete the sections in order: prepare and configure the new node, bring it online, confirm that it joined the cluster, and rebalance data on the pre-existing nodes.
Important: The new node configuration must match the existing Cassandra nodes. Before starting the node, compare
cassandra.yaml,cassandra-rackdc.properties,jvm.options, andcassandra-env.shwith a current cluster member and align every relevant setting. Only node-specific values, such aslisten_addressandbroadcast_rpc_address, should differ. Mismatched configuration is a common cause of a node failing to join.
In the examples below:
$INSTALL_DIR is the Cassandra installation directory.$clustername is the cluster name.$seedslist is the seed list.$dcname is the data center name.Set these values to match your environment before running the commands.
$INSTALL_DIR/cassandra/conf/
Edit cassandra.yaml on the new node so that its settings align with the rest of the cluster.
Set cluster_name to match the existing cluster name.
sed -i 's@cluster_name: .*@cluster_name: '$clustername'@' \
$INSTALL_DIR/cassandra/conf/cassandra.yaml
Specify the IP addresses or hostnames of at least a few existing cluster nodes in the seeds parameter. These seed nodes allow the new node to discover the existing cluster.
sed -i s/seeds:.*/"seeds: $seedslist"/g \
$INSTALL_DIR/cassandra/conf/cassandra.yaml
Set listen_address and broadcast_rpc_address to the new node's IP address.
sed -i s/listen_address:.*/"listen_address: $(hostname -I | awk '{print $1}')"/g \
$INSTALL_DIR/cassandra/conf/cassandra.yaml
sed -i s/broadcast_rpc_address:.*/"broadcast_rpc_address: $(hostname -I | awk '{print $1}')"/g \
$INSTALL_DIR/cassandra/conf/cassandra.yaml
Verify that the configured data directory paths match the other nodes in the cluster.
Verify that endpoint_snitch matches the existing cluster nodes.
If the cluster uses GossipingPropertyFileSnitch, for example:
sed -i 's@endpoint_snitch:.*@endpoint_snitch: GossipingPropertyFileSnitch@' \
$INSTALL_DIR/cassandra/conf/cassandra.yaml
Set the data center name in cassandra-rackdc.properties to match the cluster.
sed -i 's@dc=.*@dc='$dcname'@' \
$INSTALL_DIR/cassandra/conf/cassandra-rackdc.properties
Review jvm.options and ensure that it matches the other nodes in the cluster:
$INSTALL_DIR/cassandra/conf/
Review and modify cassandra-env.sh so that it matches the other nodes in the cluster:
$INSTALL_DIR/cassandra/conf/
Start the Cassandra service on the newly prepared node.
cassandra
Monitor the logs to ensure that the new node successfully joins the cluster.
From any existing node, run:
nodetool status
Confirm that the new node is listed and reports a status of UN (Up / Normal).
After the new node is Up / Normal, run nodetool cleanup on the older, pre-existing nodes to remove keys that no longer belong to them after token ranges have been rebalanced.
nodetool cleanup
Tip: Run cleanup one node at a time during a low-traffic window. Cleanup is I/O intensive and can temporarily affect performance.