Thursday 25 August 2016

SQOOP Import to HBase

Sqoop can also import data into additional targets like HBase other than HDFS and Hive. The following arguments are used in sqoop to import data from RDBMS to HBase-

--hbase-table <table_name>
                This argument instructs sqoop to import the data to the specified hbase table rather than importing into HDFS location. This argument can be used when the table in the hbase already exists or can be used to newly create a table along with the –hbase-create-table argument.

--hbase-row-key <column>
                This argument instructs sqoop which column of RDBMS should be the Row Key in HBase.

--hbase-create-table
                This argument creates a new table in hdfs if the table doesn’t exist.

sqoop import \
--connect jdbc:mysql://localhost/cts571687?user=root \
--table incremental_mysql \
--hbase-table hbase_newimport \
--hbase-row-key movieid \
--column-family metadata \
--hbase-create-table \
-m 1