sqoop mysql to import data from HDFS

1. Prepare sqoop environment and hdfs

(Temporarily omitted)

2. Create a new profile option

import
--connect
jdbc:mysql://{MYSQL_HOST}:3306/ingestion_db1?serverTimezone=UTC&rewriteBatchedStatements=true
--username
root
--password
123456--columns
id,brandcode,isdeleted
--where
1=1
--table
rbrand
--target-dir
/tmp/sqoop/data
--as-textfile
--fields-terminated-by
','
-m
1

rbrand is to export the table, as follows:

 

 

3. Run the command to start the export sqoop

sqoop --options-file option

4. Export command to check the results of the implementation of HDFS

hadoop fs -cat /tmp/sqoop/data/part-m-00000

 

Guess you like

Origin www.cnblogs.com/sen-2017/p/11460963.html