Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?
like image 429
user2597504 Avatar asked Sep 16 '13 17:09

user2597504


People also ask

What is the HBase shell?

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

What are the commands which operate on the tables in HBase?

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

How can we interact with HBase using Java API?

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.

What is HBase on top of Hadoop?

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 Answers

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
like image 163
Tariq Avatar answered Sep 30 '22 17:09

Tariq