Sqoop Export and Import Commands
Sqoop Export and Import Commands
Note : The value of primary key column or column specified in --hbaserow-key attribute become the HBase row value. If MySQL table doesn't
have primary key or column specified in --hbase-row-key attribute
doesn't have unique value then there is a lost of few records.
Example :Let us consider a MySQL table test_table which have two
columns name,address. The table test_table doesn't have primary key or
unique key column.
Records of test_table:
________________
name address
---------------abc 123
sqw 345
abc 125
sdf 1234
aql 23dw
Case 1:Import MySQL table into HDFS if table have primary key.
$ bin/sqoop import -connect jdbc:mysql://localhost:3306/db1 -username
root -password password --table tableName --target-dir
/user/ankit/tableName
Case 2:Import MySQL table into HDFS if table doesn't have primary key.
$ bin/sqoop import -connect jdbc:mysql://localhost:3306/db1 -username
root -password password --table tableName --target-dir
/user/ankit/tableName -m 1