sqoop1.4.2数据导出

一、sqoop-export  
相关参数: 
Java代码   收藏代码
  1. usage: sqoop export [GENERIC-ARGS] [TOOL-ARGS]  
  2.   
  3. Common arguments:  
  4.    --connect <jdbc-uri>                         Specify JDBC connect  
  5.                                                 string  
  6.    --connection-manager <class-name>            Specify connection manager  
  7.                                                 class name  
  8.    --connection-param-file <properties-file>    Specify connection  
  9.                                                 parameters file  
  10.    --driver <class-name>                        Manually specify JDBC  
  11.                                                 driver class to use  
  12.    --hadoop-home <dir>                          Override $HADOOP_HOME  
  13.    --help                                       Print usage instructions  
  14. -P                                              Read password from console  
  15.    --password <password>                        Set authentication  
  16.                                                 password  
  17.    --username <username>                        Set authentication  
  18.                                                 username  
  19.    --verbose                                    Print more information  
  20.                                                 while working  
  21.   
  22. Export control arguments:  
  23.    --batch                         Indicates underlying statements to be  
  24.                                    executed in batch mode  
  25.    --clear-staging-table           Indicates that any data in staging  
  26.                                    table can be deleted  
  27.    --direct                        Use direct export fast path  
  28.    --export-dir <dir>              HDFS source path for the export  
  29. -m,--num-mappers <n>               Use 'n' map tasks to export in parallel  
  30.    --staging-table <table-name>    Intermediate staging table  
  31.    --table <table-name>            Table to populate  
  32.    --update-key <key>              Update records by specified key column  
  33.    --update-mode <mode>            Specifies how updates are performed  
  34.                                    when new rows are found with  
  35.                                    non-matching keys in database  
  36.   
  37. Input parsing arguments:  
  38.    --input-enclosed-by <char>               Sets a required field encloser  
  39.    --input-escaped-by <char>                Sets the input escape  
  40.                                             character  
  41.    --input-fields-terminated-by <char>      Sets the input field separator  
  42.    --input-lines-terminated-by <char>       Sets the input end-of-line  
  43.                                             char  
  44.    --input-optionally-enclosed-by <char>    Sets a field enclosing  
  45.                                             character  
  46.   
  47. Output line formatting arguments:  
  48.    --enclosed-by <char>               Sets a required field enclosing  
  49.                                       character  
  50.    --escaped-by <char>                Sets the escape character  
  51.    --fields-terminated-by <char>      Sets the field separator character  
  52.    --lines-terminated-by <char>       Sets the end-of-line character  
  53.    --mysql-delimiters                 Uses MySQL's default delimiter set:  
  54.                                       fields: ,  lines: \n  escaped-by: \  
  55.                                       optionally-enclosed-by: '  
  56.    --optionally-enclosed-by <char>    Sets a field enclosing character  
  57.   
  58. Code generation arguments:  
  59.    --bindir <dir>                        Output directory for compiled  
  60.                                          objects  
  61.    --class-name <name>                   Sets the generated class name.  
  62.                                          This overrides --package-name.  
  63.                                          When combined with --jar-file,  
  64.                                          sets the input class.  
  65.    --input-null-non-string <null-str>    Input null non-string  
  66.                                          representation  
  67.    --input-null-string <null-str>        Input null string representation  
  68.    --jar-file <file>                     Disable code generation; use  
  69.                                          specified jar  
  70.    --map-column-java <arg>               Override mapping for specific  
  71.                                          columns to java types  
  72.    --null-non-string <null-str>          Null non-string representation  
  73.    --null-string <null-str>              Null string representation  
  74.    --outdir <dir>                        Output directory for generated  
  75.                                          code  
  76.    --package-name <name>                 Put auto-generated classes in  
  77.                                          this package  
  78.   
  79. Generic Hadoop command-line arguments:  
  80. (must preceed any tool-specific arguments)  
  81. Generic options supported are  
  82. -conf <configuration file>     specify an application configuration file  
  83. -D <property=value>            use value for given property  
  84. -fs <local|namenode:port>      specify a namenode  
  85. -jt <local|jobtracker:port>    specify a job tracker  
  86. -files <comma separated list of files>    specify comma separated files to be copied to the map reduce cluster  
  87. -libjars <comma separated list of jars>    specify comma separated jar files to include in the classpath.  
  88. -archives <comma separated list of archives>    specify comma separated archives to be unarchived on the compute machines.  


从这里我们可以看到,大部分的参数使用是与导入相同的,只有少部分是导出专用的。 

既然导入和导出的道理都是相同的,那么我就不按照自己的理解把官网上的话变成自己的话了。直接看一个例子:(这里如果你不懂,请把数据导入完整看完) 
Java代码   收藏代码
  1. $ sqoop export --connect jdbc:mysql://db.example.com/foo --table bar  \  
  2.     --export-dir /results/bar_data  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值