/usr/local/datacenter/sqoop/bin/sqoop import --connect "jdbc:mysql://192.168.3.31:3306/db?useUnicode=true&characterEncoding=utf-8" --username *** --password ** \
--query 'select uid, ip, url, method, replace(replace(replace(args, "\\", ""), "\"{", "{"), "}\"", "}"), cost, err_msg, ctime, raw_uid from sys_operate_log where ctime>="'${dt_from}'" and ctime<"'${dt_to}'" and 1=1 and $CONDITIONS UNION ALL select uid, "127.0.0.1" as ip, "xxx" as url, "POST" as method, query, 0 as cost, "" as err_msg, ctime, "60449743" as raw_uid from user_search_log where ctime>="'${dt_from}'" and ctime<"'${dt_to}'" and 1=1 and $CONDITIONS' \
--hive-import \
--hive-database hivedb \
--hive-table zl_operate_log \
--hive-drop-import-delims \
--hive-overwrite \
--hive-partition-key dt \
--hive-partition-value ${dt_partition} \
--target-dir /user/hivedb/zl/zl_operate_log/${dt_partition} \
--split-by 'ctime' \
--num-mappers 3 \
--mapreduce-job-name sync_t_zl_operate_log
网友评论