其他分享
首页 > 其他分享> > Sqoop基本导入导出命令

Sqoop基本导入导出命令

作者:互联网

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 ','

标签:--,Sqoop,导出,hive,students,导入,mysql,mydemo,root
来源: https://blog.csdn.net/m0_48379126/article/details/120651876