zoukankan      html  css  js  c++  java
  • sqoop常用命令记录

    sqoop从msyq导入数据到hive,自定建表

    sqoop import 
    --connect 'jdbc:mysql://xxx.xxx.xxx.xx:3306/database?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL' 
    --username root
    --password 123456 
    --table student_info 
    --hive-import 
    --hive-drop-import-delims 
    --create-hive-table 
    --hive-database lods 
    --hive-table  lods_source_dxxbs_student_info 
    --fields-terminated-by "01" 
    --lines-terminated-by "
    " 
    -m 1

    注意:一定要添加 --hive-drop-import-delims 否则,mysql字段中包含 会导致数据错位

    sqoop导mysql数据到hive,覆盖hive已有数据

    /data/software/sqoop-1.4.7/bin/sqoop import 
    --connect "jdbc:mysql://xxx.xxx.xxx.xxx:3306/database?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL"  
    --username root 
    --password 123456 
    --table student_info 
    --fields-terminated-by "01" 
    --hive-drop-import-delims 
    --lines-terminated-by "
    " 
    --hive-import 
    --hive-overwrite 
    --hive-database lods 
    -–create-hive-table 
    --hive-table lods_source_dxxbs_student_info 
    -m 1

     sqoop到出hive收据到mysql。且根据指定字段更新数据

     /data/software/sqoop-1.4.7/bin/sqoop export 
    --connect "jdbc:mysql://192.168.0.69:3306/interface_library?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL" 
    --username gxmanager 
    --password VItnc5IdF0#DV4VT 
    --table ldwd_basic_dxxbs_student_info_all 
    --export-dir /user/hive/warehouse/ldwd.db/ldwd_basic_dxxbs_student_info_all/ 
    --update-key student_key 
    --update-mode allowinsert 
    --input-fields-terminated-by '01' 
    --input-null-string 'null' 
    --input-null-non-string 'null' 
    -m 1
    author@nohert
  • 相关阅读:
    kotlin实现流读取
    mongo注解详解
    spring 手动注册bean
    mongo 生命周期
    GC类型以及不同类型GC的搭配 1
    GC类型以及不同类型GC的搭配
    Kotlin的高阶函数和常用高阶函数
    通过JVM日志来进行安全点分析
    js中style.display=""无效的解决方法
    Web网页性能管理详解
  • 原文地址:https://www.cnblogs.com/gzgBlog/p/15013851.html
Copyright © 2011-2022 走看看