我希望从特定表中删除大量行
我做了以下步骤: 1)为表设置gc_grace_seconds = 0 2)删除了大量的行~100万 3)Ran ./nodetool compact keyspace_name table_name
然而,当我运行nodetool compact(步骤3)时,没有任何反应。它不会开始压缩。由于墓碑数量很多,我的大部分请求现在都会超时。
该表格具有以下设置:
AND bloom_filter_fp_chance = 0.001
AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'
AND comment = ''
AND compaction = {'tombstone_threshold': '0.2', 'tombstone_compaction_interval': '86400', 'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'}
AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
AND dclocal_read_repair_chance = 0.1
AND default_time_to_live = 0
AND gc_grace_seconds = 0
AND max_index_interval = 2048
AND memtable_flush_period_in_ms = 0
AND min_index_interval = 128
AND read_repair_chance = 0.0
AND speculative_retry = '99.0PERCENTILE';
我希望压缩并摆脱墓碑,这样我才能真正摆脱不需要的数据。
我的群集中有两个节点,复制因子为2 由于我做了删除,两者之间的大小差异有所增加。相差约700MB。 我正在使用dsc-cassandra-2.1.10
cfstats如下所示
Keyspace: keyspace1
Read Count: 16316
Read Latency: 12.23892982348615 ms.
Write Count: 11078808
Write Latency: 0.6955001765532899 ms.
Pending Flushes: 0
Table: table1
SSTable count: 92
SSTables in each level: [1, 4, 38, 49, 0, 0, 0, 0, 0]
Space used (live): 38247164244
Space used (total): 38247164244
Space used by snapshots (total): 26692664189
Off heap memory used (total): 14695952
SSTable Compression Ratio: 0.32499125289530584
Number of keys (estimate): 2788
Memtable cell count: 16632
Memtable data size: 1839846
Memtable off heap memory used: 0
Memtable switch count: 93
Local read count: 16316
Local read latency: 12.239 ms
Local write count: 11078808
Local write latency: 0.696 ms
Pending flushes: 0
Bloom filter false positives: 331
Bloom filter false ratio: 0.00000
Bloom filter space used: 10960
Bloom filter off heap memory used: 10224
Index summary off heap memory used: 3672
Compression metadata off heap memory used: 14682056
Compacted partition minimum bytes: 216
Compacted partition maximum bytes: 3449259151
Compacted partition mean bytes: 25823653
Average live cells per slice (last five minutes): 405.3014160485502
Maximum live cells per slice (last five minutes): 5002.0
Average tombstones per slice (last five minutes): 0.0
Maximum tombstones per slice (last five minutes): 0.0
答案 0 :(得分:0)
压缩策略决定了nodetool compact的行为,并且版本之间的api存在细微差别
http://docs.datastax.com/en/archived/cassandra/3.x/cassandra/tools/toolsCompact.html VS https://docs.datastax.com/en/cassandra/2.1/cassandra/tools/toolsCompact.html
删除数据和逻辑删除:
执行主要压缩并在压缩策略之间切换是一项IO密集型操作 - 请考虑到这一点。