Skip to content

Manage Cassandra with nodetool

Cassandra nodetool is a command-line tool that provides a way to interact with Cassandra nodes. It is a Java application that is installed with Cassandra. It is used to perform administrative tasks such as checking the status of the cluster, adding or removing nodes, and so on.

Checking the Cluster Health

nodetool status
nodetool info
nodetool tpstats

Repairing Data

nodetool repair

nodetool repair cycling

nodetool repair cycling cycle

## monitor the progress of the repair
nodetool stats

Rebuilding Data by Getting It from Other Nodes

nodetool rebuild –keyspace cyclists, motorists

Can specify a datacenter from which the database should select the sources for the data it needs to stream through the source-dc-name option.

Cleaning Up Unnecessary Keyspaces and Partition Keys

nodetool cleanup

## or specific keyspace
nodetool cleanup cycling

Rebuilding Indexes

nodetool rebuild_index cycling cycle test_idx;

Refreshing Size Estimates of Tables

When you insert large amounts of data into a table or when you truncate a table’s data, the table’s size estimates become stale.

nodetool refreshsizeestimates

The command refreshes the system.size_estimates table.

Decommissioning Nodes

nodetool status
nodetool decommission
nodetool status
  1. First, check the status of the nodes to make sure that all the nodes are up.
  2. Run the nodetool decommission command on the node
  3. Check the status of the cluster and notice that the decommissioned node now shows its status as UL (UP LEAVING)
  4. Check the status of the cluster. Sure enough, the decommissioned node has left the cluster.

Assassinating a Node

When you run the nodetool describe cluster command, you see the node in an UNREACHABLE state.

nodetool describecluster
nodetool assassinate
nodetool assassinate -h
nodetool status

Adding a Node to a Data Center

nodetool join

Replacing a Running Node

You can simply start the new node with the -Dcassandra.replace_address option

Removing a Node from a Cluster

nodetool removenode
nodetool removenode status

Getting Information About Gossip

nodetool gossipinfo

Disabling and Enabling Gossip

You can effectively take a running node out of the cluster, without stopping the instance, by disabling the gossip protocol on that node.

nodetool disablegossip

nodetool enablegossip

Checking the State of Gossip

nodetool statusgossip

Draining a Node

nodetool drain

Flushing Data from Memtables

nodetool flush


  • Expert Apache Cassandra Administration (Sam R. Alapati)

  1. License under CC BY-NC 4.0
  2. Copyright issue feedback: dig +short txt
  3. Not all the commands and scripts are tested in production environment, use at your own risk
  4. No privacy information is collected here
Buy Me a Coffee