当前位置:   article > 正文

Sqoop的简单使用_sqoop select *

sqoop select *

Sqoop的简单使用

RDBMS到HDFS

  1. 全部导入

    $ bin/sqoop import \
    --connect jdbc:mysql://192.168.34.21:3306/company \
    --username root \
    --password 123456 \
    --table staff \
    --target-dir /company \
    --delete-target-dir \
    --fields-terminated-by "\t" \
    --num-mappers 1 \
    --split-by id
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
  2. 导入指定列 –columns

    $ bin/sqoop import \
    --connect jdbc:mysql://hadoop101:3306/company \
    --username root \
    --password 123456 \
    --table staff \
    --columns id,name \
    --target-dir /company \
    --delete-target-dir \
    --fields-terminated-by "\t" \
    --num-mappers 1 \
    --split-by id
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    提示:columns中如果涉及到多列,用逗号分隔,分隔时不要添加空格

  3. 导入指定行 –where

    $ bin/sqoop import \
    --connect jdbc:mysql://hadoop101:3306/company \
    --username root \
    --password 123456 \
    --table staff \
    --where 'id >= 1 an
    • 1
    • 2
    • 3
    • 4
    • 5
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/木道寻08/article/detail/745656
推荐阅读
相关标签
  

闽ICP备14008679号