nodetool cleanup

Cleans up keyspaces and partition keys no longer belonging to a node.

Cleans up keyspaces and partition keys no longer belonging to a node.

Synopsis

nodetool <options> cleanup --  <keyspace> <table> ...
Table 1. Options
Short Long Description
-h --host Hostname or IP address
-p --port Port number
-pwf --password-file Password file path
-pw --password Password
-u --username User name
-- Separates an option from an argument that could be mistaken for a option.
Other options are:
  • keyspace is a keyspace name.
  • table is one or more table names, separated by a space.

Description

Use this command to remove unwanted data after adding a new node to the cluster. Cassandra does not automatically remove data from nodes that lose part of their partition range to a newly added node. Run nodetool cleanup on the source node and on neighboring nodes that shared the same subrange after the new node is up and running. Failure to run this command after adding a node causes Cassandra to include the old data to rebalance the load on that node. Running the nodetool cleanup command causes a temporary increase in disk space usage proportional to the size of your largest SSTable. Disk I/O occurs when running this command.

Optionally, this command takes a list of table names. If you do not specify a keyspace, this command cleans all keyspaces no longer belonging to a node.