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?
Bash shell is the default command interpreters for most of Linux and Unix operating distributions HBase advanced versions provides shell commands jruby-style object oriented references for tables
The commands which operate on the tables in HBase, are Data Definition Language i. Create This command creates a table. ii. List It lists all the tables in HBase. iii. Disable This command disables a table. iv. Is_disabled Whereas, it verifies whether a table is disabled. This command enables a table. vi. Is_enabled
We can interact with HBase using this both methods. The only difference between these two is Java API use java code to connect with HBase and shell mode use shell commands to connect with HBase. HBase uses Hadoop files as storage system to store the large amounts of data.
After successful installation of HBase on top of Hadoop, we get an interactive shell to execute various commands and perform several operations. Using these commands, we can perform multiple operations on data-tables that can give better data storage efficiencies and flexible interaction by the client.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With