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
网友评论