[英]delete row key from cassandra cli
我将列族gcgraceseconds设置为0; 但剧照行键未删除,仍保留在我的列族中
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中删除行时,不会立即删除该行。 而是用墓碑标记。 效果是,您仍然可以获得该键的结果,但是不会传递任何列。 需要墓碑是因为
对于要移除的行及其墓碑,需要压实。 此过程将重新组织数据文件,并且在执行此操作时会修剪已删除的行。 也就是说,如果已经达到墓碑的GC宽限期。 对于单节点(!)群集,可以将宽限期设置为0是可以的,因为不必将删除传播到任何其他节点(在发布删除的时间点可能已关闭)。
如果要强制删除已删除的行,则可以通过nodetool实用程序触发刷新(与数据文件同步内存)和大型压缩。 例如
./nodetool flush your_key_space the_column_family && ./nodetool compact your_key_space the_column_family
压缩完成后,删除的行应真正消失。
默认的GC宽限期为十天(平均846000秒),以便立即删除行键
UPDATE COLUMN FAMILY column_family_name with GC_GRACE= 0;
执行上述cli查询,然后执行nodetool刷新和紧凑操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.