我将我的列族gcgraceseconds设置为0; 但是仍然没有删除rowkey,它仍留在我的列族中
create column family workInfo123 with column_type = 'Standard' and comparator = 'UTF8Type' and default_validation_class = 'UTF8Type' and key_validation_class = 'UTF8Type' and read_repair_chance = 0.1 and dclocal_read_repair_chance = 0.0 and populate_io_cache_on_flush = true and gc_grace = 0 and min_compaction_threshold = 4 and max_compaction_threshold = 32 and replicate_on_write = true and compaction_strategy = 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy' and caching = 'KEYS_ONLY' and default_time_to_live = 0 and speculative_retry = 'NONE' and compression_options = {'sstable_compression' : 'org.apache.cassandra.io.compress.LZ4Compressor'} and index_interval = 128;
见下面的观点
[default@winoriatest] list workInfo123; Using default limit of 100 Using default cell limit of 100 ------------------- RowKey: a ------------------- RowKey: xx 2 Rows Returned. Elapsed time: 17 msec(s).
我正在使用cassandra -cli我应该改变其他任何东西
更新: -使用后 ./nodetool -host 127.0.0.1 compact
[default@winoriatest] list workInfo123; Using default limit of 100 Using default cell limit of 100 ------------------- RowKey: xx 2 Rows Returned. Elapsed time: 11 msec(s).
为什么xx
还有?
当您删除Cassandra中的行时,它不会立即被删除.相反,它标有墓碑.结果是,您仍然可以获得密钥的结果,但不会传递任何列.墓碑是必需的,因为
Cassandra数据文件一旦"满"就变为只读; 墓碑将添加到包含已删除行的当前打开的数据文件中.
您必须为群集提供将删除传播到包含该行副本的所有节点的机会.
要删除行及其墓碑,需要进行压缩.此过程重新组织数据文件,当它执行此操作时,它会修剪已删除的行.也就是说,如果已达到墓碑的GC宽限期.对于单节点(!)群集,可以将宽限期设置为0,因为删除不必传播到任何其他节点(在您发出删除的时间点可能会下降).
如果要强制删除已删除的行,可以通过nodetool实用程序触发刷新(与数据文件同步内存)和主要压缩.例如
./nodetool flush your_key_space the_column_family && ./nodetool compact your_key_space the_column_family
压缩完成后,删除的行应该真的消失了.