Disk space is not freed even after removing the key from cassandra db and compressing

I created a key space and a table (columnfamily) in it. Say "ks.cf"

After entering several hundred thousand rows in columnfamily cf I saw disk usage with df -h .

Then I reset the DROP KEYSPACE ks using the DROP KEYSPACE ks cqlsh from cqlsh .

After removal, the use of the disk remains the same also used. I also made nodetool compact , but no luck.

Can someone help me in setting up these things to free up disk space after deleting data / rows?

+5
source share
2 answers

If you are just trying to delete rows, you need to let the delete step go through a regular delete cycle (delete_row-> tombstone_creation-> compaction_actually_deletes_the_row).

Now, if you want to completely get rid of your keyspace, check your cassandra data folder (it should be specified in your yaml file). In my case it is "/ mnt / cassandra / data /". This folder has a subfolder for each keyspace (i.e. ks). You can simply completely delete the folder associated with your keyword.

If you want to save the folder, it's good to know that cassandra creates a snapshot of your key space before dropping it. Basically a backup of all your data. You can simply go to the "ks" folder and find the snapshot subdirectory. Go to the snapshot subdirectory and delete the snapshot associated with your keystroke.

+2
source

Recently, a problem has arisen. After deleting the table, a snapshot is created. This snapshot will allow you to roll it back if it is not intended. If you still want to return this hard disk space, follow these steps:

nodetool -h localhost -p 7199 clearsnapshot

on the respective nodes. Alternatively, you can disable snapshots using auto_snapshot: false in cassandra.yml.

edit: spelling / grammar

+5
source

Source: https://habr.com/ru/post/1233618/


All Articles