mysql —— hdfs (条件导入):
sqoop import \
--connect jdbc:mysql://192.168.1.101:3306/mydemo \
--username root \
--password root \
--target-dir '/kb13/students' \
--delete-target-dir \
--num-mappers 1 \
--fields-terminated-by ',' \
--query 'select * from students where age<70 and $CONDITIONS;'
hdfs —— mysql
sqoop export \
--connect jdbc:mysql://192.168.1.101:3306/mydemo \
--username root \
--password root \
--table stus \
--export-dir '/kb13/students' \
--num-mappers 1 \
--input-fields-terminated-by ','
mysql —— hive
sqoop import \
--connect jdbc:mysql://192.168.1.101:3306/mydemo \
--username root \
--password root \
--table students \
--num-mappers 1 \
--hive-import \
--fields-terminated-by ',' \
--hive-overwrite \
--delete-target-dir \
--hive-table mydemo.students
hive —— mysql
sqoop export \
--connect jdbc:mysql://192.168.1.101:3306/mydemo \
--username root \
--password root \
--table stu1 \
--export-dir '/hive110/warehouse/mydemo.db/students' \
--num-mappers 1 \
--input-fields-terminated-by ','