2

关于墓碑压实

我想知道为什么我不能在 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. 执行“节点工具刷新”

  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 ......没有产生墓碑压缩......

我想尝试“墓碑压缩”。

4

1 回答 1

2

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

于 2013-07-11T16:13:20.667 回答