Sqoop Export HDFS
Sqoop Export HDFS
Sqoop Export 应用场景——直接导出
直接导出
sqoop export \
--connect
'jdbc:mysql://192.168.x.200/dwqdb_test?useUnicode=true&characterEncodig=utf-8' \
--username root \
--password-file /user/hadoop/.password \
--table dwq_user_copy \
--export-dir /sqoop/test/dwq_user \
--input-fields-terminated-by "@"
Sqoop Export 应用场景——指定map数
指定map数
sqoop export \
--connect
'jdbc:mysql://192.168.x.200/dwqdb_test?useUnicode=true&characterEncoding=utf-8' \
--username root \
--password-file /user/hadoop/.password \
--table dwq_user_copy \
--export-dir /sqoop/test/dwq_user \
--input-fields-terminated-by "@" \
-m 1
Sqoop Export 应用场景——插入和更新
插入和更新
sqoop export \
--connect
'jdbc:mysql://192.168.x.200/dwqdb_test?useUnicode=true&characterEncoding=utf-8' \
--username root \
--password-file /user/hadoop/.password \
--table dwq_user_copy \
--export-dir /sqoop/test/dwq_user \
--input-fields-terminated-by "@" \
-m 1
--update-key id \
--update-mode allowinsert
Sqoop Export 应用场景——事务处理
事务处理
sqoop import \
--connect
'jdbc:mysql://192.168.x.200/dwqdb_test?useUnicode=true&characterEncoding=utf-8' \
--username root \
--password-file /user/hadoop/.password \
--table dwq_user_copy \
--staging-table dwq_user_copy_tmp \
--clear-staging-table \
--export-dir /sqoop/test/dwq_user \
--input-fields-terminated-by "@"\
Sqoop Export 应用场景——字段不对应问题
字段不对应问题
sqoop export \
--connect
'jdbc:mysql://192.168.x.200/dwqdb_test?useUnicode=true&characterEncoding=utf-8' \
--username root \
--password-file /user/hadoop/.password \
--table dwq_user_copy \
--columns name,sex,age,profile \
--export-dir /sqoop/test/dwq_user \
--input-fields-terminated-by "@" \
-m 1
- 点赞
- 收藏
- 关注作者
评论(0)