https://segmentfault.com/a/1190000002532293
https://www.zybuluo.com/aitanjupt/note/209968
create table dep(id int,name string) row format delimited fields terminated by ' ';
11 sssssssss
22 ttttttttt
33 vvvvvvvvv
load data local inpath '/opt/people.txt' into table hive.dep;
mysql -uroot -proot
use metastore;
select * from TBLS where TBL_NAME='dep';
hive -e "select * from hive.dep limit 3"
hdfs dfs -ls /
sqoop import --connect jdbc:mysql://127.0.0.1:3306/metastore --username root --password root --table TBLS
测试MySQL连接
sqoop list-databases --connect jdbc:mysql://127.0.0.1:3306/mysql --username root --password root
检验SQL语句
sqoop eval --connect jdbc:mysql://ucampus-test.cmtmrzrxlu53.rds.cn-northwest-1.amazonaws.com.cn:3306/ucampus --username ucauser --password 'Key!go003' --query "SELECT * from base_course"
sqoop import --connect jdbc:mysql://ucampus-test.cmtmrzrxlu53.rds.cn-northwest-1.amazonaws.com.cn:3306/ucampus --username ucauser --password 'Key!go003' --query "SELECT * from stu_student where sch_id=4 AND $CONDITIONS" --split-by date --target-dir /user/hive/warehouse/anqi_wang
--fields-terminated-by " " --lines-terminated-by "
" -m 1 --hive-import --hive-overwrite --create-hive-table --hive-table book --delete-target-dir
sqoop import --connect jdbc:mysql://localhost:3306/sqoop
--username root
-P
--split-by id
--columns id,name
--table customer
--target-dir /user/cloudera/ingest/raw/customers
--fields-terminated-by ","
--hive-import
--create-hive-table
--hive-table sqoop_workspace.customers
sqoop import --connect jdbc:mysql://ucampus-test.cmtmrzrxlu53.rds.cn-northwest-1.amazonaws.com.cn:3306/ucampus --username ucauser --password 'Key!go003' ---driver com.mysql.jdbc.Driver --split-by id --columns id,name --table stu_student --target-dir /user/hive/warehouse/hive/dep --fields-terminated-by "," --hive-import --create-hive-table --hive-table hive.dep
cd /usr/lib/sqoop/lib/
yum install unzip
wget http://www.java2s.com/Code/JarDownload/java-json/java-json.jar.zip
unzip java-json.jar.zip
cp /usr/lib/hive/lib/hive-common-1.1.0-cdh5.9.1.jar /usr/lib/sqoop/lib/
cp /usr/lib/hive/lib/hive-shims-*.jar /usr/lib/sqoop/lib
sqoop import --connect jdbc:mysql://ucampus-test.cmtmrzrxlu53.rds.cn-northwest-1.amazonaws.com.cn:3306/ucampus --username ucauser --password 'Key!go003' --driver com.mysql.jdbc.Driver --split-by id --columns id,name --table stu_student --target-dir /user/hive/warehouse/hive/dep3 --fields-terminated-by "," --hive-import --create-hive-table --hive-table hive.dep3