Hbase Bulk Loading with importtsv


Hadoop Eco System Forums Hadoop Discussion Forum Hbase Bulk Loading with importtsv

This topic contains 0 replies, has 1 voice, and was last updated by  Siva 4 years, 4 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #3059

    Siva
    Keymaster

    ImportTsv helps you to upload data in HBase from a tsv file placed on hdfs.

    Lets take and example hbase table , “employee” with column family “basic_info”

    Prerequisite: HBase employe should get created prior to bulk importtsv command. 

    Following is an example file on hdfs:

    $ hadoop fs -cat /user/hadoop/importtsv

    1    emp1    24

    2    emp2    26

    3    emp3    24

    Uploading data int o employee table using ImportTsv

    $HBASE_HOME/bin/hbase org.apache.hadoop.hbase.mapreduce.ImportTsv -Dimporttsv.columns=HBASE_ROW_KEY,basic_info:empname,basic_info:age employee /user/hadoop/importtsv

    First column of the file will be stored as  row key, second column will be stored as  “empname” and third column will be stored as age as follows:

    hbase(main):013:0>scan ’employee’

    ROW                                                  COLUMN+CELL                                                                                                                                             

     1                                                   column=basic_info:age, timestamp=1360238054613, value=24                                                                                               

     1                                                   column=basic_info:empname, timestamp=1360238054613, value=emp1                                                                                       

     2                                                   column=basic_info:age, timestamp=1360238054613, value=26                                                                                               

     2                                                   column=basic_info:empname, timestamp=1360238054613, value=emp2                                                                                  

     3                                                  column=basic_info:age, timestamp=1360238054613, value=24                                                                                               

     3                                                   column=basic_info:empname, timestamp=1360238054613, value=emp3

Viewing 1 post (of 1 total)

The topic ‘Hbase Bulk Loading with importtsv’ is closed to new replies.