zoukankan      html  css  js  c++  java
  • hive sqoop,sqoop-hive import data

    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

  • 相关阅读:
    js正则表达式中的问号使用技巧总结
    380. Insert Delete GetRandom O(1)
    34. Find First and Last Position of Element in Sorted Array
    162. Find Peak Element
    220. Contains Duplicate III
    269. Alien Dictionary
    18. 4Sum
    15. 3Sum
    224. Basic Calculator
    227. Basic Calculator II
  • 原文地址:https://www.cnblogs.com/SZLLQ2000/p/10709770.html
Copyright © 2011-2022 走看看