简体   繁体   中英

Cassandra: how to get total table size / estimate row count

Intro

I'm trying to gather some stats from a Cassandra 1.2.6 cluster to implement a web service to provide those stats to a web app. I'm accessing the cluster from Python using the cql library, but I can ssh or pssh to the nodes as well.

The problem

My problem is how to get the total table size (ie the actual disk usage of each table) in the entire cluster, and if possible the total row count of each table (this can be an estimate).

The question

So far the only option I've found seems to be running nodetool cfstats on each node and parse the response, is there a better way of doing this?

Thanks in advance!

I think the best way to do this would be to access the statistics directly through JMX (which is how nodetool actually works.) Each node provdies a wide range of metrics but what you would be interested in are.

org.apache.cassandra.metrics
  ColumnFamily
    cf_name
       TotalDiskSpaceUsed
       MemtableDataSize

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM