Replace a dead node
The procedure for replacing a dead node is generally the same for clusters using vnodes or a single-token architecture. There are a few extra steps required for specific architectures and when replacing dead seed nodes. These extra steps are indicated where necessary.
|
When replacing or adding nodes, only use new nodes.
A new node is a system where HCD has never started.
The node must have absolutely no previous data in the Data loss or corruption can occur if you use a recycled node, such as a node moved from another cluster, because the existing data on the recycled node is merged into the cluster. |
Verify the node’s status
Run nodetool status to check the condition of the node that you want to replace.
This command returns a two-letter code describing the status and state of each node in the cluster.
For example, UN means a node is in Up status and Normal state.
To replace a node, the following conditions must be true:
-
The output of
nodetool statusshows the node inDown(D) status andNormal(N) state. The node you want to replace must not report a transitional state likeJoining(J) orLeaving(L). -
HCD isn’t running on the node. Specifically, the HCD Java process must be stopped or the host itself must be offline.
|
A node in |
The output of nodetool status depends on your cluster architecture and the node where you run the command.
Nodes can report their own condition differently than the condition seen by other nodes in the cluster.
A HCD node in Down status can have one of the following states:
-
Normal(N) -
Leaving(L) -
Joining(J) -
Moving(M) -
Stopped(S)
If a node is Down and Stopped, the output of nodetool status shows DS when run on the node itself and DN when run from any other node in the cluster.
Replace the dead node
-
Get the following information from the dead node:
-
IP address.
-
Datacenter and rack information:
-
If the cluster uses the PropertyFileSnitch: Get the dead node’s rack and datacenter assignments from the
cassandra-topology.propertiesfile. -
If the cluster uses the GossipingPropertyFileSnitch, Ec2Snitch, Ec2MultiRegionSnitch, or GoogleCloudSnitch: Get the rack and datacenter assignments from the dead node’s
cassandra-rackdc.propertiesfile.
-
-
Single-token architecture only (not vnodes):
initial_tokenvalue fromcassandra.yaml.
-
-
Add the replacement node to the network and record its IP address.
Make sure the replacement node meets the hardware and system requirements for your workloads.
-
Install HCD on the new node but don’t start HCD.
You must install the same HCD version (major, minor, and patch) on all nodes in a cluster.
-
If HCD starts automatically on the node, stop HCD and then clear the data that was added automatically on startup.
The node must be clear of data before joining the cluster as a replacement node.
-
If the dead node was a seed node, change the cluster’s seed node configuration on each node:
-
In the
cassandra.yamlfile for each node, remove the IP address of the dead node from the- seedslist in theseed-providerproperty. -
If a replacement seed node is needed, add the new node’s IP address to the
- seedslist of the other nodes. -
Run
nodetool reloadseedsto force the node to read the changes to the- seedslist in thecassandra.yamlfile.
Don’t make every node a seed node because it increases maintenance and reduces gossip performance. Gossip optimization isn’t critical, but DataStax recommends a small seed list with two or three seed nodes per datacenter.
-
-
From a healthy node’s
cassandra.yamlfile, get thecluster_name,endpoint_snitch, and any other non-default values that you need to configure the new node.Use the
diffcommand to compare configuration files for healthy nodes with the default configuration files. -
Configure the new node’s
cassandra.yamlfile using the values that you gathered earlier.In particular, make sure the following settings are configured correctly:
-
auto_bootstrap: If set tofalsefor other nodes in the cluster, set it totrueon the replacement node. This option isn’t explicitly set in the defaultcassandra.yamlconfiguration file, and it defaults totrue. -
initial_token: Only required for single-token architectures. -
- seedslistIf the new node is a seed node, make sure it is not listed in its own
- seedslist.
-
-
Add the rack and datacenter configuration to the snitch configuration files on all nodes in the cluster:
Only add the new node to the snitch configuration files. Do not remove the original entry for the dead node yet.
-
If the cluster uses the GossipingPropertyFileSnitch, Ec2Snitch, Ec2MultiRegionSnitch, or GoogleCloudSnitch: Add the dead node’s rack and datacenter assignments to the
cassandra-rackdc.propertiesfile on the replacement node. -
If the cluster uses the PropertyFileSnitch:
-
Copy the
cassandra-topology.propertiesfile from an existing node to the replacement node. -
In each node’s
cassandra-topology.propertiesfile, add an entry with the new node’s IP address and the dead node’s rack and datacenter assignments. -
Delete the
cassandra-topology.propertiesfile from the dead node.
-
-
-
Start the new node with the
-Dcassandra.replace_address_first_bootstart up option in addition to any other startup options that you typically used for the dead node.The value of
replace_address_first_bootis the dead node’s IP address.- Package installations
-
Add the option to the
jvm-server.optionsfile, and then start the node:JVM_OPTS="$JVM_OPTS -Dcassandra.replace_address_first_boot=ADDRESS_OF_DEAD_NODE" - Tarball installations
-
sudo INSTALL_DIRECTORY/bin/hcd cassandra \ -Dcassandra.replace_address_first_boot=ADDRESS_OF_DEAD_NODE
-
Run
nodetool statusto verify that the new node has bootstrapped successfully. -
For package installations, remove
replace_address_first_bootfromjvm-server.options. -
If using the PropertyFileSnitch, wait at least 72 hours, and then remove the dead node’s IP address from the
cassandra-topology.propertiesfile on all nodes in the cluster.This ensures that dead node’s information is removed from gossip. If removed from the property file too soon, problems can occur. Use
nodetool gossipinfoto check the gossip status. The node is still in gossip untilLEFTstatus disappears.This step isn’t required when using other snitches because the
cassandra-rackdc.propertiesfile doesn’t contain IP addresses.