Search code examples
nosqlhbasehbase-shell

HBase Shell command questions


I have some questions about HBase Shell Command Tool:

1: How to list all column family names (just names!) in a table?
2: How to count the number of rows in a column family?

Solution

  • 1: How to list all column family names (just names!) in a table?

    Not possible OOTB. But you could do something like this :

    echo "scan 'table'" | bin/hbase shell | awk -F'=' '{print $2}' | awk -F ':' '{print $1}'
    

    2: How to count the number of rows in a column family?

    What do you mean by this? Do you intend to ask How to count the number of column families in a rows? If this is what you need, try this :

    echo "scan 'table'" | bin/hbase shell | grep cf | wc -l