sqoop参数详解

原文:作者:海底苍鹰
地址:http://blog.51yip.com/hadoop/2054.html

sqoop参数含义:

Import和export参数解释

Common arguments:

--connect <jdbc-uri> :连接RDBMS的jdbc连接字符串,例如:–connect jdbc:mysql:// MYSQL_SERVER:PORT/DBNAME。

--connection-manager <class-name> :

--hadoop-home <hdir> :

--username <username> :连接RDBMS所使用的用户名。

--password <password> :连接RDBMS所使用的密码,明文。

--password-file <password-file> :使用文件存储密码。

-p :交互式连接RDBMS的密码。

Import control arguments:

--append :追加数据到HDFS已经存在的文件中。

--as-sequencefile :import序列化的文件。

--as-textfile :import文本文件 ,默认。

--columns <col,col,col…> :指定列import,逗号分隔,比如:–columns “id,name”。

--delete-target-dir :删除存在的import目标目录。

--direct :直连模式,速度更快(HBase不支持)

--split-by :分割导入任务所使用的字段,需要明确指定,推荐使用主键。

--inline-lob-limit < n > :设置内联的BLOB对象的大小。

--fetch-size <n> :一次从数据库读取n个实例,即n条数据。

-e,--query <statement> :构建表达式<statement>执行。

--target-dir <d> :指定HDFS目标存储目录。

--warehouse-dir <d> :可以指定为-warehouse-dir/user/hive/warehouse/即导入数据的存放路径,如果该路径不存在,会首先创建。

--table <table-name> :将要导入到hive的表。

--where <where clause> :指定where从句,如果有双引号,注意转义 \$CONDITIONS,不能用or,子查询,join。

-z,--compress :开启压缩。

--null-string <null-string> :string列为空指定为此值。

--null-non-string <null-string> :非string列为空指定为此值,-null这两个参数are optional, 如果不设置,会指定为”null”。

--autoreset-to-one-mapper :如果没有主键和split-by用one mapper import (split-by和此选项不共存)。

-m,--num-mappers <n> :建立n个并发执行import,默认4个线程。

Incremental import arguments:

--check-column <column> :Source column to check for incremental change

--incremental <import-type> :Define an incremental import of type ‘append’ or ‘lastmodified’

--last-value <value> :Last imported value in the incremental check column

Hive arguments:

--create-hive-table :自动推断表字段类型直接建表,hive-overwrite功能可以替代掉了,但Hive里此表不能存在,不然操作会报错。

--hive-database <database-name> :指定要把HDFS数据导入到哪个Hive库。

--hive-table <table-name> :设置到Hive当中的表名。

--hive-delims-replacement <arg> :导入到hive时用自定义的字符替换掉\n, \r, and \01。

--hive-drop-import-delims :导入到hive时删除字段中\n, \r,\t and \01等符号;避免字段中有空格导致导入数据被截断。

--hive-home <dir> :指定Hive的存储目录。

--hive-import :将HDFS数据导入到Hive中,会自动创建Hive表,使用hive的默认分隔符。

--hive-overwrite :对Hive表进行覆盖操作(需配合--hive-import使用,如果Hive里没有表会先创建之),不然就是追加数据。

--hive-partition-key <partition-key> :hive分区的key。

--hive-partition-value <partition-value> :hive分区的值。

--map-column-hive <arg> :类型匹配,SQL类型对应到hive类型。

HBase arguments:

--column-family < family > :把内容导入到hbase当中,默认是用主键作为split列。

--hbase-create-table :创建Hbase表。

--hbase-row-key < col > :指定字段作为row key ,如果输入表包含复合主键,用逗号分隔。

--hbase-table < table-name > :指定hbase表。

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值