About compation

本文详细解释了Cassandra中的两种压缩策略:minor compaction与major compaction的工作原理及触发机制。此外,还介绍了如何通过min_compaction_threshold与max_compaction_threshold参数来控制压缩行为,以优化数据库性能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

minor compaction vs. major compaction
min compaction threshold vs. max compaction threshold

问题一、
minor compaction vs. major compaction
1.major compaction 只能手动的通过nodetool触发,对整个column family所有的sstable进行compact;minor compcation通过配置参数min compaction threshold 和max compaction threashold达到条件后触发
2.在0.7-beta2版本之后,non-major compation 在比较bloom filter确认tombstone标示的row不存在于其它sstable中也可以将其删除。
因为minor compaction会根据min compaction threshold 和max compaction threashold对文件进行合并,并不一定会对CF所有的SSTABLE合并,所以不保证会删除所有的tombstone.

<!--
(0.7-beta2 --add by wm)
* remove tombstones during non-major compactions when bloom filter //如果在其他节点还有呢???
verifies that row does not exist in other sstables (CASSANDRA-1074)
--&gt

问题二、
min compaction threshold vs. max compaction threshold

1.compaction threshold 有两种设置方式
一种是使用JMX和nodetool设置,这个设置方式不是持久的,下次启动后失效;并且只对当前节点生效,不会扩散到集群中的其它节点。
#nodetool -h localhost setcompactionthreshold Keyspace1 Standard1 0 0
另一种方式是使用cli,这种配置是持久的,而且会扩展到其它节点。
cli>update column family X with min_compaction_threshold=Y and max_compaction_threshold=X

2.
- min_compaction_threshold: Avoid minor compactions of less than this number of sstable files
- max_compaction_threshold: Compact no more than this number of sstable files at once[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23937368/viewspace-1053965/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/23937368/viewspace-1053965/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值