Skip to content

Guide to Apache HBase

July 10, 2014


Apache HBase is Column Family database used to provide structure to data stored in Apache Hadoop HDFS. It is based on Google Big Table.


Start Shell

$ hbase shell


Useful Commands


hbase> help

Show All Tables

hbase> list

Describe Table

hbase> describe '{table_name}'

Create HBase Table

hbase> create '{table_name}', '{column_family_name}'

List ALL contents of Table

hbase> scan '{table_name}'

Manually Scan Table with Row Count Filter

hbase> scan '{table_name}', {FILTER =>{number_of_rows_count})}

Count Number of Rows in Table

hbase> count '{table_name}'

Insert Item into Table

hbase> put '{table_name}', '{row_key}', '{column_family}:{column}', '{value}'

Truncate Table

hbase> truncate '{table_name}'

Delete Table

hbase> disable '{table_name}'
hbase> drop '{table_name}'

View Snapshots

hbase> list_snapshots

Take a Snapshot of a Table

hbase> snapshot '{table_name}', '{snapshot_name}'

Restore a Snapshot

hbase> disable '{table_name}'
hbase> restore_snapshot '{snapshot_name}'
hbase> enable '{table_name}'

Stop Command Line Shell

hbase> quit


hbase> exit


Ctrl + Z
  1. I like these recent posts, very succinct, look forward to others. Just a silly question – can HBase actions be scripted like with Hive?

    • Thanks a lot! Let me know if you have any suggestions for improvements.

      To my knowledge, no there isn’t a way to really script any HBase Queries. It’s not like hive where you can create a sql script and execute that from the command line.

      But if you find that I’m wrong please let me know!

      • One way in which you could theoretically do something akin to scripting is piping the output of an echo command to the hbase shell.

        For example:
        $ echo “list” | hbase shell

        This would pass the list command and run it in hbase.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: