"键数"来自" nodetool cfstats" cassandra中的输出2.1.2。现在如何计算行数?

时间:2014-11-28 10:11:37

标签: cassandra datastax datastax-java-driver database nosql

我非常需要ColumnFamily中的行数,但"键数"来自" nodetool cfstats" cassandra中的输出2.1.2。现在如何获得行数?

这是cfstats的输出

Keyspace: liftrmt
    Read Count: 0
    Read Latency: NaN ms.
    Write Count: 0
    Write Latency: NaN ms.
    Pending Flushes: 0
            Table: reportcodedaycount
            SSTable count: 4
            Space used (live): 11.49 MB
            Space used (total): 11.49 MB
            Space used by snapshots (total): 0 bytes
            SSTable Compression Ratio: 0.38099920748493266
            Memtable cell count: 0
            Memtable data size: 0 bytes
            Memtable switch count: 0
            Local read count: 0
            Local read latency: NaN ms
            Local write count: 0
            Local write latency: NaN ms
            Pending flushes: 0
            Bloom filter false positives: 0
            Bloom filter false ratio: 0.00000
            Bloom filter space used: 64 bytes
            Compacted partition minimum bytes: 444.17 KB
            Compacted partition maximum bytes: 6.68 MB
            Compacted partition mean bytes: 4.17 MB
            Average live cells per slice (last five minutes): 0.0
            Maximum live cells per slice (last five minutes): 0.0
            Average tombstones per slice (last five minutes): 0.0
            Maximum tombstones per slice (last five minutes): 0.0

2 个答案:

答案 0 :(得分:4)

您需要使用可通过JMX访问的新指标。我将使用JConsole访问它们。

打开jconsole,然后导航到:

org.apache.cassandra.metrics
    -> ColumnFamily
        -> ksname (in my case test)
            -> cfname (in my case group)
                -> EstimatedColumnCountHistogram
                    -> Attributes -> Value

打开long [90]数组,在我的例子中,它是第二个值。这些是sstables中的键,如果它在memtable中,它不能通过这个度量访问(即如果你想看到它,你需要将你的memtables刷新到sstables)。

为了清晰起见,下面插入了 test.group 的22个唯一键的屏幕截图...

JConsole showing 22 inserted keys into cassandra

有关new metrics API的更多信息。

答案 1 :(得分:1)

更新:此问题现已在2.1.3中解决。

我继续为此创造了一个jira。不确定为什么2.1.2中缺少键的数量: https://issues.apache.org/jira/browse/CASSANDRA-8400