export data
In Sqoop, the "Export" concept refers to: Cluster (RDBMS) for transmitting data from a large data cluster (HDFS, HIVE, HBASE) to non-big data, called: export, namely the use of export keyword.
HIVE / HDFS to RDBMS
$ bin/sqoop export \ --connect jdbc:mysql://hadoop102:3306/company \ --username root \ --password 000000 \ --table staff \ --num-mappers 1 \ --export-dir /user/hive/warehouse/staff_hive \ --input-fields-terminated-by "\t"
Tip: Mysql if the table does not exist, does not automatically create
Script package
File format using the opt package sqoop command, and then execute
1) Create a file .opt
$ mkdir opt $ touch opt/job_HDFS2RDBMS.opt
2) to write the script sqoop
$ We opt / job_HDFS2RDBMS.opt
export --connect jdbc:mysql://hadoop102:3306/company --username root --password 000000 --table staff --num-mappers 1 --export-dir /user/hive/warehouse/staff_hive --input-fields-terminated-by "\t"
3 ) Execute the script
$ bin/sqoop --options-file opt/job_HDFS2RDBMS.opt