如何检查cassandra中的压缩策略是否已更改?

时间:2017-03-23 11:14:55

标签: cassandra

我是否将压缩策略从大小更改为水平?有没有办法检查压缩是否已经改变?

2 个答案:

答案 0 :(得分:1)

登录cqlsh并检查表结构。

$cqlsh> desc keyspacebname.tablename; 

您将看到表压缩类:

CREATE TABLE keyspacebname.tablename (
    .....
    PRIMARY KEY (..)
) WITH CLUSTERING ORDER BY (... DESC)
    AND bloom_filter_fp_chance = 0.01
    AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'
    ...
    AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'}
    AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    ....

您还可以通过nodetool检查压缩状态:

$> nodetool  compactionstats

了解更多详情,请查看以下链接: nodetool compactionstats

答案 1 :(得分:0)

您可以在查询中找到压缩信息:

对于Cassandra版本< 3

SELECT compaction_strategy_class,compaction_strategy_options,max_compaction_threshold, min_compaction_threshold FROM system.schema_columnfamilies  WHERE keyspace_name = 'your_keyspace_name' AND columnfamily_name = 'your_table_name';

对于Cassandra版本> = 3

SELECT compaction FROM system_schema.tables WHERE keyspace_name = 'your_keyspace_name' AND table_name = 'your_table_name' ;