This topic provides answers to some frequently asked questions about Sqoop.
What do I do if the timestamp field shows a delay of eight hours when I import data from ApsaraDB RDS into EMR?
- Description:
- The Test_Table table in ApsaraDB RDS contains a timestamp field.
- The following command is used to import data in the Test_Table table to EMR HDFS:
sqoop import \ --connect jdbc:mysql://rm-2ze****341.mysql.rds.aliyuncs.com:3306/s***o_sqoopp_db \ --username s***o \ --password ****** \ --table play_evolutions \ --target-dir /user/hadoop/output \ --delete-target-dir \ --direct \ --split-by id \ --fields-terminated-by '|' \ -m 1
- The import result is queried.
In the query result, the timestamp field shows a delay of eight hours.
- Solution: When you import the data, delete the --direct parameter from the import command.
sqoop import \ --connect jdbc:mysql://rm-2ze****341.mysql.rds.aliyuncs.com:3306/s***o_sqoopp_db \ --username s***o \ --password ****** \ --table play_evolutions \ --target-dir /user/hadoop/output \ --delete-target-dir \ --split-by id \ --fields-terminated-by '|' \ -m 1
The query results are normal.