zoukankan      html  css  js  c++  java
  • Sqoop 命令

    1)list-databases     List available databases on a server
    sqoop list-databases --connect jdbc:db2://<server>:<port>/<database> --username username --password password

    2) list-tables        List available tables in a database
    sqoop list-tables --connect jdbc:db2://<server>:<port>/<database> --username username --password password
     
    3) create-hive-table  Import a table definition into Hive
    sqoop create-hive-table --connect jdbc:db2://<server>:<port>/<database> --username username --password password –table tablename  –hive-table hivetablename
    其中 –table tablename为db2中的数据库database中的表 –hive-table hivetablename 为hive中新建的表名称
     
    4) eval               Evaluate a SQL statement and display the results
    sqoop eval --connect jdbc:db2://<server>:<port>/<database> --username username --password password -query 'SELECT * FROM <tablename>'
     
    5) import             Import a table from a database to HDFS

    sqoop import --connect jdbc:db2://<server>:<port>/<database> --username username --password password --compress --compression-codec 'com.hadoop.compression.lzo.LzopCodec' -table tablename --hcatalog-database hiveschema --hcatalog-table hivetable -m 1

    其中 –table tablename为db2中的数据库database中的表 --hcatalog-database hiveschema 为hive中Schema --hcatalog-table hivetable为hive中表名称

    sqoop import --connect jdbc:db2://<server>:<port>/<database> --username username --password password --compress --compression-codec 'com.hadoop.compression.lzo.LzopCodec' -table tablename --columns <column> --hcatalog-database hiveschema --hcatalog-table hivetable --hive-partition-key <partition-name> --hive-partition-value <partition-value> -m 1 

    6) import-all-tables  Import tables from a database to HDFS

    7) export             Export an HDFS directory to a database table

    sqoop export --connect jdbc:db2://<server>:<port>/<database> --username username --password password  -table tablename --hcatalog-database hiveschema --hcatalog-table hivetable -m 1

    8) merge              Merge results of incremental imports

     

    9) job                Work with saved jobs

     

    10) metastore          Run a standalone Sqoop metastore

     sqoop version

    11) help               List available commands

    sqoop help

    sqoop COMMAND help

    12) codegen            Generate code to interact with database records

     

    13) version            Display version information

    sqoop version

  • 相关阅读:
    webDriver检索table数据
    C# 遍历枚举
    Java——Iterate through a HashMap
    Java——Read/convert an InputStream to a String
    简单的异步HTTP服务端和客户端
    授信主体查找
    mysql 事务测试
    mysql 替换
    如何查看由EF生成的SQL?
    C# 如何用多字符分割字符串
  • 原文地址:https://www.cnblogs.com/longjshz/p/5524344.html
Copyright © 2011-2022 走看看