How to know the size of a keyspace and column family in Cassandra?

主宰稳场 提交于 2019-12-20 11:55:10

问题


Recently I've started working on Grails integration with Cassandra using the Java driver for cassandra(cassandra-driver-core-2.0.2). So I was curious to know how we can find out how much size our table is taking to store the data in cassandra DB.

I have created a keyspace with name Customkeyspace and a column family called Movie in it. So I was curious to know which tool/Command I have to use to know the size of the keyspace/Column family ?


回答1:


To get statistics regarding column families in Cassandra, you can simply run the command:

nodetool cfstats

It reports statistics about tables which include the live data size as well as on disk.

The documentation about this utility for Cassandra 2.1 is available here.




回答2:


To get the statistics regarding column families in Cassandra with respect to keyspaces or tables, you can simply run the below command:

nodetool cfstats

Result: This will return the complete statistics related to available keyspaces.

But, in case you want to find out the statistics of specific keyspaces or tables, run below command:

For Keyspace(s) : nodetool cfstats <keyspace_name> OR nodetool cfstats -H <keyspace_name>

For Table(s) : nodetool tablestats <keyspace_name>.<table_name> OR nodetool tablestats -H <keyspace_name>.<table_name>

Note: -H denotes Human Readable format

For more details please refer, nodetool cfstats

Findings:

  1. You might see SSTable count as 0

  2. Space used (live) and Space used (total) as 0 bytes

To know WHY(s) of the above two findings please refer: Reason of why SSTable count shown as 0



来源:https://stackoverflow.com/questions/27011886/how-to-know-the-size-of-a-keyspace-and-column-family-in-cassandra

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!