我非常需要ColumnFamily中的行数,但cassandra 2.1.2中的“nodetool cfstats”输出中缺少“键数”.现在如何计算行数?
这是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
解决方法
您需要使用可通过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个唯一键的屏幕截图…
更多关于new metrics API.