问题
I am using Datastax 2.1 community version in EC2. I dropped a big table (column family) in a keyspace and ran "nodetool compact " but from OpsCenter UI, I don't see any increase in storage capacity.
I ran "nodetool compactionstats " to see whether compaction is on-going but there is nothing: $ nodetool compactionstats pending tasks: 0 Active compaction remaining time : n/a
Is there some other process I need to follow?
回答1:
Cassandra, in its default configuration, keeps a snapshot of every column family that is dropped. This is by design so you don't lose the data of a cf if you accidentally delete a cf.
You can disable the snapshot creation in cassandra.yaml. From the docs (see: http://www.datastax.com/documentation/cassandra/2.1/cassandra/configuration/configCassandra_yaml_r.html ):
auto_snapshot (Default: true) Enable or disable whether a snapshot is taken of the data before keyspace truncation or dropping of tables. To prevent data loss, using the default setting is strongly advised. If you set to false, you will lose data on truncation or drop.
If you don't disable auto snapshots you can remove the generated snapshot via nodetool clearsnapshot. See: http://www.datastax.com/documentation/cassandra/2.0/cassandra/tools/toolsClearSnapShot.html
来源:https://stackoverflow.com/questions/26200440/how-to-reclaim-storage-from-a-column-family-in-cassandra