HBase CRUD Operations

posted on Nov 20th, 2016

Apache HBase

Apache HBase is an open source, non-relational, distributed database modeled after Google's BigTable and is written in Java. It is developed as part of Apache Software Foundation's Apache Hadoop project and runs on top of HDFS (Hadoop Distributed File System), providing BigTable-like capabilities for Hadoop. That is, it provides a fault-tolerant way of storing large quantities of sparse data (small amounts of information caught within a large collection of empty or unimportant data, such as finding the 50 largest items in a group of 2 billion records, or finding the non-zero items representing less than 0.1% of a huge collection).

Pre Requirements

1) A machine with Ubuntu 14.04 LTS operating system.

2) Apache Hadoop pre installed (How to install Hadoop on Ubuntu 14.04)

3) Apache HBase pre installed (How to install HBase on Ubuntu 14.04)

HBase Create, Retreive, Update, Delete (CRUD) operation

Step 1 - Change the directory to /usr/local/hbase

$ cd /usr/local/hbase

Step 2 - To start up the initial HBase cluster.

$ ./start-hbase.sh

Creating Table

hbase> create 'emp','personal data','professional data'

Inserting Data into Table

hbase> put 'emp','1','personal data:name','raju'
hbase> put 'emp','1','personal data:city','hyderabad'
hbase> put 'emp','1','professional data:designation','manager'
hbase> put 'emp','1','professional data:salary','50000'

HBase CRUD Operations

View or Scan

hbase> scan 'emp'

Update

hbase> put 'emp','1','personal data:city','Delhi'

Verify or Scan

hbase> scan 'emp'

Retrieve

hbase> get 'emp', '1'

hbase> get 'emp', '1', {COLUMN=>'personal data:name'}

Delete

hbase> delete 'emp', '1', 'personal data:city'

hbase> deleteall 'emp','1'

View or Scan

hbase> scan 'emp'

Count and Truncate

hbase> count 'emp'

hbase> truncate 'emp'

hbase> scan 'emp'

Grant, revoke and list all permissions

hbase> grant 'praveen', 'RWXCA'

hbase> revoke 'praveen'

hbase> user_permission 'emp'

Please share this blog post and follow me for latest updates on

facebook             google+             twitter             feedburner

Previous Post                                                                                          Next Post

Labels : HBase Standalone Mode Installation   HBase Pseudo Distributed Mode Installation   HBase Fully Distributed Mode Installation   HBase Shell Usage   HBase Admin Java API Example   HBase Client Java API Example