zoukankan      html  css  js  c++  java
  • sqoop

    sqoop import
    
    --connect jdbc:mysql://h2:3306/test
    
    --username hive
    
    --password 123456
    
    --table t6
    
    --incremental lastmodified
    
    --check-column last_update
    
    --merge-key address_id
    
    --last-value '2019-05-05 19:43:11'
    
    -m 1

    注:incremental:

    (1)append

    (2)lastmodified:

    merger-key(合并相同的merge)

    append (追加)

    sqoop job 
    --create job_address
    -- import
    --connect jdbc:mysql://h2:3306/test
    --username hive
    --password-file '/user/grid/passwd.pwd'
    --table t6
    --incremental lastmodified
    --check-column last_update
    --merge-key address_id
    --last-value '2019-05-05 19:43:11'
    -m 1

    注:指定
    --split-by或者 -m 1

    -- import 中间有空格

    --password-file 指定集群内文件,作为密码文件

    生成方式 例:

    echo -n "123456" > passwd.pwd

    hdfs dfs -put passwd.pwd /user/grid

    hdfs dfs chmod 400 /user/grid/passwd.pwd

    sqoop job --help(查看sqoop job常见用法)

    sqoop job --create test 
     -- import -Dorg.apache.sqoop.splitter.allow_text_splitter=true
     --connect jdbc:mysql://h2:3306/test 
     --username hive 
     --password-file /user/grid/jobaddress.pwd 
     --query 'select address_id, address,last_update from t6 where $CONDITIONS and address_id>1' 
     --target-dir '/user/grid/' 
     --incremental lastmodified 
     --check-column last_update 
     --merge-key address_id 
     --last-value '2019-05-05 19:43:11' 
     --split-by address 

    注:这种写法报错,在使用job时,如何指定split 列(text类型)

    和crontab组合,做定时job

  • 相关阅读:
    关于非旋转Treap
    CSP2019第二轮-划水游记
    题解 Luogu P3370
    CF926B Add Points
    日常卡题
    关于SPFA
    用Docker部署自己的JupyterHub
    请不要在JDK7及以上用Json-lib了
    SQL Server 2000向SQL Server 2008 R2推送数据
    .NET实现微博粉丝服务平台接口
  • 原文地址:https://www.cnblogs.com/jy627625/p/10817768.html
Copyright © 2011-2022 走看看