cassandra에서 alter table로 compaction 전략을 변경할 수 있다. 



ALTER TABLE table WITH compaction = { 'class' :  'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'  }


사실 처음부터 compaction을 설정하려면 ALTER TABLE 없이 CREATE TABLE에 with compaction을 두어도 된다.

CREATE TABLE story.test1 (

  block_id uuid,

  species text,

  alias text,

  population varint,

  PRIMARY KEY (block_id)

) WITH compression =

    { 'sstable_compression' : 'DeflateCompressor', 'chunk_length_kb' : 64 }

  AND compaction =

    { 'class' : 'LeveledCompactionStrategy'};




카산드라 2.0.11 이상의 버전을 사용할 때 compaction 정책을 정할 때, 다음 규칙을 이용하는 것이 좋다. 


- 쓰기가 많은 작업에는 SizeTiredCompationStrategy을 사용한다.

- 읽기가 많은 작업에는 LeveledCompactionStrategy를 사용한다.

- 시계열과 데이터 만료 작업에는 DateTieredCompactionStrategy를 사용한다. 


https://docs.datastax.com/en/cassandra/2.0/cassandra/dml/dml_write_path_c.html#concept_ds_wt3_32w_zj__logging-writes-and-memtable-storage



You can configure these types of compaction to run periodically: SizeTieredCompactionStrategy, DateTieredCompactionStrategy (Cassandra 2.0.11), and LeveledCompactionStrategy.


SizeTieredCompactionStrategy is designed for write-intensive workloads, DateTieredCompactionStrategy for time-series and expiring data, and LeveledCompactionStrategy for read-intensive workloads. You can manually start compaction using the nodetool compact command.





compaction 전략에 대한 설명은 다음을 참고한다. 


http://www.datastax.com/dev/blog/when-to-use-leveled-compaction



https://docs.datastax.com/en/cassandra/2.1/cassandra/operations/ops_configure_compaction_t.html



http://www.datastax.com/dev/blog/when-to-use-leveled-compaction



http://www.datastax.com/dev/blog/datetieredcompactionstrategy



https://labs.spotify.com/2014/12/18/date-tiered-compaction/







cassandra의 compaction설정은 테이블 단위라면, hbase의 compaction 설정은 클러스터 단위이다.


http://knight76.tistory.com/entry/%EA%B3%B5%EB%B6%80-Hbase-compaction





'cassandra' 카테고리의 다른 글

[cassandra] nodetool disablebinary  (0) 2017.01.11
[cassandra] cassandra 서버를 안전하게 재시작하기  (0) 2017.01.09
[cassandra] select count(*) 구하기  (0) 2016.12.07
[cassandra] read repair  (0) 2016.11.23
[cassandra] cqlsh 팁  (0) 2016.11.21
Posted by '김용환'
,