Importing relational database table to hbase table - Sqoop is the best tool for it.
Its a two step process
1. create hbase table
2. import the data from relational table to hbase table using sqoop import
[mapr@hostname lib]$ hbase shell
hbase(main):002:0> create 'DV_PRODUCTION_BRANCHES', 'DETAILS'
1. copy oracle driver to lib - /opt/mapr/sqoop/sqoop-1.4.6/lib/
sqoop import --connect jdbc:oracle:thin:@LOCALHOST:1521/DVTST --username DV_PRD --password dv_tst \
--table DV_PRODUCTION_BRANCHES \
--columns "PRODUCTION_BRANCH_ID,NAME" \
--hbase-table 'DV_PRODUCTION_BRANCHES' \
--column-family DETAILS \
--hbase-row-key PRODUCTION_BRANCH_ID \
-m 1
Its a two step process
1. create hbase table
2. import the data from relational table to hbase table using sqoop import
- hbase - create table in hbase
[mapr@hostname lib]$ hbase shell
hbase(main):002:0> create 'DV_PRODUCTION_BRANCHES', 'DETAILS'
- Sqoop - copy oracle driver and load the data into hbase table using below command.
1. copy oracle driver to lib - /opt/mapr/sqoop/sqoop-1.4.6/lib/
2. run sqoop import
--table DV_PRODUCTION_BRANCHES \
--columns "PRODUCTION_BRANCH_ID,NAME" \
--hbase-table 'DV_PRODUCTION_BRANCHES' \
--column-family DETAILS \
--hbase-row-key PRODUCTION_BRANCH_ID \
-m 1
Points to be noted -
- DV_PRODUCTION_BRANCHES is the relational table in DVTST database
- DV_PRODUCTION_BRANCHES is name of the hbase table with column family DETAILS and rowkey as PRODUCTION_BRANCH_ID
- Sqoop doesn’t permit multiple column families at the time of when this blog was written. You need to create HBase table first with multiple column family and then execute three Sqoop import operations to import each column family.
No comments:
Post a Comment