import --connect jdbc:mysql://192.168.11.2:3306/bookstack?characterEncoding=utf8 --username root --password 0000 --query “select concat(document_id,’=’,markdown,’=’,content,’+++’)content from md_document_store WHERe $CONDITIONS” --target-dir /user/hive/warehouse/stg_app.db/md_document_store -delete-target-dir --split-by ‘’
import --hive-import --connect jdbc:mysql://192.168.11.2:3306/bookstack?characterEncoding=utf8 --username root --password 0000 --hive-overwrite --hive-database dl_app --hive-table l_table_1 --table table_1 -m 1 --mysql-delimiters --input-fields-terminated-by ,
Oracleimport --hive-import --connect jdbc:oracle:thin:@//localhost:1521/testdb --username bigdata --password bigdata --hive-overwrite --hive-database dl_app --hive-table l_vehicle --table APP.SYS_USER -m 1
使用参数import --hive-import --connect ${url} --username ${username} --password ${password} --hive-overwrite --hive-database dl_lj --hive-table l_table_1 --table table_1 -m 1 --mysql-delimiters
导出 – 对于导出乱码的情况可以参考: 去掉 --direct ,注意
export --connect jdbc:mysql://localhost:3306/data?characterEncoding=utf-8&useUnicode=true --username dp --password dp --table table_1 --export-dir /user/hive/warehouse/dl_app.db/l_table_1_export --input-fields-terminated-by “,” --input-null-string “N” --null-non-string “N” --mysql-delimiters -m 1
eval --connect “jdbc:mysql://localhost:3306/db?characterEncoding=utf-8&useUnicode=true” --username root --password 0000 --query “CALL p_test()”
在脚本中调用sqoop,并循环执行,参数在argument中添加#!/bin/bash:set encoding=utf8export PYTHON_EGG_CACHE=/root/.python-eggstartnum=$1endnum=$2for ((days=startnum;days<=endnum;days++))do # echo ${days} sqoop eval --connect "jdbc:mysql://localhost:3306/db?characterEncoding=utf-8&useUnicode=true" --username root --password 0000 --query "CALLp_test()"done