zoukankan      html  css  js  c++  java
  • 大数据技术之Sqoop配置示例

    大数据技术之Sqoop配置示例


    hdfstomysql

    export
    --connect
    jdbc:mysql://bigdatacloud:3306/test
    --username
    root
    --password
    123
    --table
    hdfstomysql
    --columns
    id,name,age
    -m
    1
    --export-dir
    hdfs://mycluster/hdfstomysql



    mysqltohive

    import
    --connect
    jdbc:mysql://bigdatacloud:3306/test
    --username
    root
    --password
    123
    --target-dir
    /sqoop/THive
    --delete-target-dir
    --as-textfile
    -m
    1
    --table
    T_P
    --columns
    id,name,age
    --hive-import
    --hive-overwrite
    --hive-table
    T_hive


    mysqltohdfs

    import
    --connect
    jdbc:mysql://bigdatacloud:3306/test
    --username
    root
    --password
    123
    --target-dir
    /sqoop/T1
    --delete-target-dir
    --as-textfile
    -m
    1
    --table
    T_P
    --columns
    id,name,age



    ------------------------

    import
    --connect
    jdbc:mysql://node3:3306/test
    --username
    root
    --password
    123456
    --query
    'select p.id,name,age,c.card_id,date_format(c.create_date,'%Y-%m-%d') as c_date  from t_person p join t_id_card c on p.id=c.p_id where p.age>17 and $CONDITIONS'
    --target-dir
    /sqoop/test3
    --delete-target-dir
    --as-textfile
    -m
    1
    --null-string
    ''
    --null-non-string
    ''
    --hive-import
    --hive-overwrite
    --create-hive-table
    --hive-table
    t_person_card
    --hive-partition-key
    day
    --hive-partition-value
    '2016-07-03'

    -------------------------

    export
    --connect
    jdbc:mysql://node3:3306/test
    --username
    root
    --password
    123456
    --table
    t_person
    --columns
    id,name,age
    -m
    1
    --export-dir
    hdfs://laoxiao/test

    --------------------------------

    import
    --connect
    jdbc:mysql://node3:3306/test
    --username
    root
    --password
    123456
    --table
    t_person
    --columns
    id,name,age
    --where
    1=1
    --target-dir
    /sqoop/test1
    --delete-target-dir
    --as-textfile
    -m
    1
    --null-string
    ''
    --null-non-string
    ''

    =---------------------------

    import
    --connect
    jdbc:mysql://node3:3306/test
    --username
    root
    --password
    123456
    --query
    'select p.id,name,age,c.card_id,date_format(c.create_date,'%Y-%m-%d') as c_date  from t_person p join t_id_card c on p.id=c.p_id where p.age>17 and $CONDITIONS'
    --target-dir
    /sqoop/test2
    --delete-target-dir
    --as-textfile
    -m
    1
    --null-string
    ''
    --null-non-string
    ''









  • 相关阅读:
    dubbo源码阅读-服务订阅(八)之本地订阅(injvm)
    dubbo源码阅读-服务订阅(八)之主流程
    dubbo源码阅读-服务暴露(七)之远程暴露(dubbo)
    dubbo源码阅读-配置(二)之API配置
    dubbo源码阅读-容器启动(六)
    LIRe 源代码分析 6:检索(ImageSearcher)[以颜色布局为例]
    LIRe 源代码分析 5:提取特征向量[以颜色布局为例]
    LIRe 源代码分析 4:建立索引(DocumentBuilder)[以颜色布局为例]
    智能电视大战背后的秘密
    二线视频网站突围战
  • 原文地址:https://www.cnblogs.com/TendToBigData/p/10501406.html
Copyright © 2011-2022 走看看