美文网首页
sqoop 使用案例

sqoop 使用案例

作者: 夜空最亮的9星 | 来源:发表于2019-06-05 14:40 被阅读0次

原文链接

RDBMS 到HDFS

全部导入

$ bin/sqoop import \
--connect  jdbc:mysql://localhost:3306/test \
--username root \
--password 123456 \
--table student   \
--target-dir /user/company  \
--delete-target-dir \
--num-mappers 1   \
--fileds-terminated-by "\t"

查询导入:

$ bin/sqoop import \
--connect  jdbc:mysql://localhost:3306/test \
--username root \
--password 123456 \
--target-dir /user/company \
--delete-target-dir \
--num-mappers 1  \
--fileds-terminated-by "\t" \
--query 'select name,sex from student '

使用 sqoop 关键字筛选查询导入数据

$ bin/sqoop import \
--connect  jdbc:mysql://localhost:3306/test \
--username root \
--password 123456 \
--table student \
--target-dir /user/company \
--delete-target-dir \
--num-mappers 1  \
--fileds-terminated-by "\t" \
--where "id=1"

RDBM 到Hive

$ bin/sqoop import \
--connect  jdbc:mysql://localhost:3306/test \
--username root \
--password 123456 \
--table student \
--num-mappers 1     \
--hive-import \
--fileds-terminated-by "\t" \
--hive-overwrite \
--hive-table student

相关文章

网友评论

      本文标题:sqoop 使用案例

      本文链接:https://www.haomeiwen.com/subject/zdtsxctx.html