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> ...)
  • Options are:
    • ( -h | --host ) <host name> | <ip address>
    • ( -p | --port ) <port number>
    • ( -pw | --password ) <password >
    • ( -u | --username ) <user name>
    • ( -pwf <passwordFilePath | --password-file <passwordFilePath> )
  • -- separates an option from an argument that could be mistaken for a option.
  • 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.

Running this command affects nodes that use a counter column in a table. Cassandra assigns a new counter ID to the node.

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.