Reputation: 394
On my 5-node cluster, I issued various drop table <keyspace_name>.<table_name>
commands. After that action, their data on individual nodes still persists under /var/lib/cassandra/data//
I would like to know if there has been any best practice on freeing up space.
Or, would the rm -rf /var/lib/cassandra/data/<keyspace_name>/*
command on respective nodes suffice?
Upvotes: 3
Views: 2522
Reputation: 57808
would the
rm -rf /var/lib/cassandra/data/<keyspace_name>/*
command on respective nodes suffice?
Yes, that would do it.
Upvotes: 5
Reputation: 2389
When you drop a table, cassandra automatically creates a snapshot (just in case). If you're sure that you'll no longer need the data, you should run
nodetool clearsnapshot
on the affected nodes. Note that this form of the command will remove all snapshots. The complete command to specify a particular snapshot or keyspace in cassandra 3 is:
nodetool <options> clearsnapshot -t <snapshot> -- <keyspace> ...
Upvotes: 2
Reputation: 788
first, run this command to show hash of file directory contained data of keyspacse_1.table_1 in /var/lib/cassandra/data :
SELECT * from system_schema.tables WHERE keyspace_name='keyspace_1' AND table_name='table_1';
see the id of response query for this table.
and then check the files in /data that haven't this id and remove them.
for examlpe : id feteched in cql is : d9b8ab90-1240-11e8-8680-f9685b9421a5
or other ids.
but /data include dir similar below that this id not in response of cql! :
table_1-c9b8ab90-1240-11e8-8680-f9685b9321e5/
in this stage, you could remove this file to freeing up space
Upvotes: 1