每日总结(sqoop基本用法)

发布时间 2023-09-21 18:14:49作者: 旺旺大菠萝

mysqluser_info表数据导入到HDFS/test路径

 1 bin/sqoop import \
 2 --connect jdbc:mysql://hadoop102:3306/gmall \    库名
 3 --username root \
 4 --password 123456\
5 --table user_info \ 表名 6 --columns id,login_name \ 列名 7 --where "id>=1 and id<=20" \ 条件

等同于--query "select id,login_name from user_info where id>=1 and id<=20 and $CONDITIONS" \
8 --target-dir /test \ hdfs目录 9 --delete-target-dir \ 10 --fields-terminated-by '\t' \ 分隔符 11 --num-mappers 2 \ 分两片 (id=1___id=10 , id=11___id=20) 12 --split-by id 通过id分片