Database Reference
In-Depth Information
We can run the
cleanup
command to clean up keyspaces and partition keys which
are not related to data nodes, or data that doesn't belong to that node.
Generally we execute this command to delete data from a node that has just been
added to the cluster. Whenever a new node joins in the ring, using the
cleanup
com-
mand we can remove the obsolete data that is not related to the cluster. Also we per-
form this command whenever a node becomes live after it has been decommissioned or
removed from the cluster ring. We can run this command:
vivek@vivek-Vostro-3560:~/software/local-cluster/
node4$bin/nodetool cleanup twitter_keyspace twiiter
Here we are performing cleanup on
twitter
table of keyspace
twit-
ter_keyspace
. Please note that if we don't specify the keyspace, it will perform a
cleanup over all available keyspaces. Also, we can perform a cleanup over multiple
tables in a keyspace by providing a list of table names:
nodetool cleanup <keyspace><table1><table2>
clearsnapshot
Snapshot directories are generally created for the backup and restore processes. When
snapshot directories are no longer required for a keyspace, we can clear them using the
clearsnapshot
command:
vivek@vivek-Vostro-3560:~/software/local-cluster/node4$
bin/nodetool clearsnapshot twitter_keyspace
Running the preceding command, deletes all snapshot directories for the keyspace
twitter_keyspace
. We can also delete specific snapshot directories using the
-f
option as follows:
vivek@vivek-Vostro-3560:~/software/local-cluster/node4$
bin/nodetool clearsnapshot
twitter_keyspace -f 1412341689
Generally, clearing snapshots is part of the backup process, and regular backing up
and deleting snapshot directories would be scheduled background cron jobs. A cron job
is a time-based scheduler that can be set up as a component of the backup process.