如何在cassandra中打印已配置的columnfamilies

时间:2013-09-28 17:43:13

标签: cassandra cql column-family

我在配置脚本与我正在使用的列家族名称相匹配时遇到了一些麻烦。我觉得能够记录所有当前配置的列族是一个有用的调试工具。

这可能吗?我一直在寻找谷歌团体,并没有发现任何提及这样的事情。

2 个答案:

答案 0 :(得分:0)

要显示所有键空间及其各自的列族,您可以使用 nodetool cfstats

它将一个很长的列表:

lyubent:bin lyubentodorov$ ./nodetool cfstats
Keyspace: system_traces                           <-------- KS
    Read Count: 0
    Read Latency: NaN ms.
    Write Count: 0
    Write Latency: NaN ms.
    Pending Tasks: 0
        Column Family: sessions                   <-------- CF
        SSTable count: 0
        Space used (live): 0
        Space used (total): 0
        ...

        Column Family: events                     <-------- CF
        SSTable count: 0
        Space used (live): 0
        Space used (total): 0
        Number of Keys (estimate): 0
        Memtable Columns Count: 0

 ...ETC....

答案 1 :(得分:0)

@Slater Tyranus

对于CQL3表

>echo "describe keyspace <your_keyspace_name>;" > command.cql
>cqlsh -3 -f command.cql > /tmp/schema.txt

对于Thrift列系列

>echo "describe keyspace <your_keyspace_name>;" > command.txt
>cassandra-cli -f command.txt > /tmp/schema.txt