Creating a Table using HBase Shell
1) create command : create command use to create table . in this create command two things you must specify the table name and the Column Family name. The syntax to create a table in HBase shell is shown below.
create ‘<table name>’,’<column family>’
Example 1:
create 'employee', 'personal data', 'professional data'
2) list command : this command is use to list all tables. The synax to list all tables in HBase shell is shown below.
list
Example 2:
list
3) put command : put command use to insert rows into a table. Its syntax is as follows:
put ’<table name>’,’row1’,’<colfamily:colname>’,’<value>’
Example 3:
put 'employee','1','personal data:name','sameer'
put 'employee','1','personal data:city','pune'
put 'employee','1','professional data:designation','hadoop administrator'
put 'employee','1','professional data:salary','280000'
4) get command : get command use to read data from a table in HBase.The following example shows how to use the get command
get ’<table name>’,’row1’
Example 4:
get 'employee', '1'
5) describe command : describe command returns the description of the table. Its syntax is as follows
describe 'table name'
Example 5:
describe 'employee'
6) scan command : scan command is used to view the data in HTable. Using the scan command, you can get the table data. Its syntax is as follows.
scan ‘<table name>’
Example 6:
scan 'employee'
7) disabling command : disabling command is use to disable table in HBase Shell.
The syntax to disable a table in HBase shell is shown below.
Example 7:
disable 'employee'
8) is_disabled command: is_disabled command is used to find whether a table is disabled. Its syntax is as follows.
Example 8:
is_disabled 'table name'
is_disabled 'employee'
9) disable_all command: disable_all command is use to disable all the tables matching the given regex. all the tables matching the given regex
disable_all 'e.*'
Example 9:
disable_all 'e.*'
10) drop command: drop command is use to dropping a table using HBase Shell.
Note : Before dropping a table, you have to disable it first.
Example 10:
disable 'employee'
drop 'employee'