yesterday=`date -d "@$(($(date +%s)- 86400))" '+%Y-%m-%d'`
today=`date -d "@$(($(date +%s)))" '+%Y-%m-%d'`
sqoop import \
--connect jdbc:mysql://主机:3306/表 \
--username 用户名\
--password 密码\
--query "select line1,line2 from 库.表 where line1 >= '${yesterday} 00:00:00' and line2 <'${today} 00:00:00' and \$CONDITIONS " \
--driver com.mysql.jdbc.Driver \
--hive-overwrite \
--hcatalog-database 库\
--hcatalog-table 表\
--hcatalog-partition-keys 分区字段\
--hcatalog-partition-values ${yesterday} \
--hcatalog-storage-stanza 'stored as orc' \
--split-by 字段名\#容错手段
-m 1
|