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

  • 相关阅读:
    测试同学都应该知道的断言知识...
    自己如何修改Airtest的源码
    如何选择适合你的图像识别算法
    如何测试基于Unity3D引擎的游戏
    Web前端-按钮点击效果(水波纹)
    C# Email 帮助类 EmailHelper
    WinForm 加载大数据时不闪烁的ListView
    LZZ磁力资源搜索4.2.2,整合多个站点,大部分资源都能搜到
    C#7.0新特性和语法糖详解
    6种css3 transform图片悬停动态效果
  • 原文地址:https://www.cnblogs.com/SZLLQ2000/p/10709770.html
Copyright © 2011-2022 走看看