# Nodetool cleanup¶

cleanup [<keyspace> <tablename ...>]- triggers the immediate removal of data from node(s) that “lose” part of their token range due to a range movement operation (node addition or node replacement).

• An optional keyspace and column family (table) can be specified.
• If no keyspace was specified, it will perform cleanup keys in all keyspaces
• When nodes were added to a cluster it becomes necessary to use the nodetool cleanup command on all nodes in the cluster, except the ones added
• There is no need to run cleanup when nodes are being removed permanently
• When nodes were replaced the cleanup may be necessary and it will depend on whether token range assignment was changed

For example:

To clean up the data of a specific node and specific keyspace use this command:

nodetool -h <host name> cleanup <keyspace>


Warning

Make sure there are no topology changes before running cleanup. To validate, run nodetool status, all nodes should be in status Up Normal (UN).

Note

If using Scylls Enterprise 2018.1.5, Scylla Open Source 2.2.0, 2.3.0 or lower version Do not run the nodetool cleanup command before upgrading to the latest release of your branch, see this issue for further information.

Nodetool Reference