如何在cassandra 1.2.6中生成“墓碑压实”

时间:2013-07-11 10:32:36

标签: cassandra tombstone

关于tombstone compaction

我想知道为什么我不能在cassandra1.2.6中制作“墓碑压实”。

[步骤]

  1. 在cassandra-cli中创建列族

    create keyspace keyspace1 with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy' and strategy_options = {replication_factor:3};

    use keyspace1;

    create column family cf1 with comparator=AsciiType and default_validation_class=AsciiType and key_validation_class=AsciiType and compaction_strategy_options={tombstone_compaction_interval: 1, tombstone_threshold: '0.1'} and gc_grace=600 and column_metadata=[ {column_name: column1, validation_class: LongType} ];

  2. 使用cassandra-cli中的TTL输入一些数据,如下所示

    set cf1['key1']['column1']=100 with ttl = 1;
    set cf1['key2']['column1']=200 with ttl = 1;
    set cf1['key3']['column1']=300 with ttl = 1;
    set cf1['key4']['column1']=400 with ttl = 600;
    set cf1['key5']['column1']=500 with ttl = 600;
    set cf1['key6']['column1']=600 with ttl = 600;

  3. 执行'nodetool flush'

  4. 使用sstable2json检查Data.db

    {"key": "2412441","columns": [["column1","100",1373516242953000,"d"]]},
    {"key": "2412442","columns": [["column1","200",1373516242963000,"d"]]},
    {"key": "2412443","columns": [["column1","300",1373516242973000,"d"]]},
    {"key": "2412444","columns": [["column1","400",1373516242983000,"e",600,1373516300]]},
    {"key": "2412445","columns": [["column1","500",1373516242983000,"e",600,1373516300]]},
    {"key": "2412446","columns": [["column1","600",1373516242983000,"e",600,1373516300]]}

  5. 等待超过1小时...... Data.db没有变化....墓碑压实没有产生......

  6. 输入一些数据并再次执行nodetool flush ...刚刚创建了新的Data.db ...没有生成墓碑压缩......

  7. 我想尝试'墓碑压实'。

1 个答案:

答案 0 :(得分:2)

你可能在sstable中没有足够的数据让Cassandra猜测墓碑比率。您可以使用ColumnFamilyStoreMBean中的getDroppableTombstoneRatio方法通过JMX进行检查。