sqoop-1.4.6安装与使用
一、安装
export HADOOP_COMMON_HOME=/usr/local/hadoop-2.6.3
export HADOOP_MAPRED_HOME=/usr/local/hadoop-2.6.3
export HBASE_HOME=/usr/local/hbase-1.1.3
export HIVE_HOME=/usr/local/hive-2.0.0
#export ZOOCFGDIR=
Argument Description
--connect <jdbc-uri> Specify JDBC connect string
--connection-manager <class-name> Specify connection manager class to use
--driver <class-name> Manually specify JDBC driver class to use
--hadoop-mapred-home <dir> Override $HADOOP_MAPRED_HOME
--help Print usage instructions
--password-file Set path for a file containing the authentication password
-P Read password from console
--password <password> Set authentication password
--username <username> Set authentication username
--verbose Print more information while working
--connection-param-file <filename> Optional properties file that provides connection parameters
--relaxed-isolation Set connection transaction isolation to read uncommitted for the mappers.
$ sqoop import --connect jdbc:mysql://database.example.com/employees
$ sqoop import --connect jdbc:mysql://database.example.com/employees \
--username venkatesh --password-file ${user.home}/.password
--append |
Append data to an existing dataset in HDFS |
--as-avrodatafile |
Imports data to Avro Data Files |
--as-sequencefile |
Imports data to SequenceFiles |
--as-textfile |
Imports data as plain text (default) |
--as-parquetfile |
Imports data to Parquet Files |
--boundary-query <statement> |
Boundary query to use for creating splits |
--columns <col,col,col…> |
Columns to import from table --columns "name,employee_id,jobtitle" |
--delete-target-dir |
Delete the import target directory if it exists |
--direct |
Use direct connector if exists for the database |
--fetch-size <n> |
Number of entries to read from database at once. |
--inline-lob-limit <n> |
Set the maximum size for an inline LOB |
-m,--num-mappers <n> |
Use n map tasks to import in parallel |
-e,--query <statement> |
Import the results of statement . select min(<split-by>), max(<split-by>) from <table name> |
--split-by <column-name> |
Column of the table used to split work units. Cannot be used with --autoreset-to-one-mapper option.以某个字段平衡负载 |
--autoreset-to-one-mapper |
Import should use one mapper if a table has no primary key and no split-by column is provided. Cannot be used with--split-by <col> option. |
--table <table-name> |
Table to read |
--target-dir <dir> |
HDFS destination dir |
--warehouse-dir <dir> |
HDFS parent for table destination |
--where <where clause> |
WHERE clause to use during import |
-z,--compress |
Enable compression |
--compression-codec <c> |
Use Hadoop codec (default gzip) |
--null-string <null-string> |
The string to be written for a null value for string columns |
--null-non-string <null-string> |
The string to be written for a null value for non-string columns |
bin/sqoop list-databases --connect jdbc:mysql://yangxw:3306/mysql --username root --password root
bin/sqoop import --connect jdbc:mysql://yangxw:3306/classicmodels --username root --password root --table customers --target-dir /mysql_hadoop
$ sqoop import \
--query 'SELECT a.*, b.* FROM a JOIN b on (a.id == b.id) WHERE $CONDITIONS' \
--split-by a.id --target-dir /user/foo/joinresults
$ sqoop import ... --map-column-java id=String,value=Integer
--hive-home <dir> Override $HIVE_HOME
--hive-import Import tables into Hive (Uses Hive’s default delimiters if none are set.)
--hive-overwrite Overwrite existing data in the Hive table.
--create-hive-table If set, then the job will fail if the target hive
table exits. By default this property is false.--hive-table <table-name> Sets the table name to use when importing to Hive.
--hive-drop-import-delims Drops \n, \r, and \01 from string fields when importing to Hive.
--hive-delims-replacement Replace \n, \r, and \01 from string fields with user defined string when importing to Hive.
--hive-partition-key Name of a hive field to partition are sharded on
--hive-partition-value <v> String-value that serves as partition key for this imported into hive in this job.
--map-column-hive <map> Override default mapping from SQL type to Hive type for configured columns.
--column-family <family> |
Sets the target column family for the import |
--hbase-create-table |
If specified, create missing HBase tables |
--hbase-row-key <col> |
Specifies which input column to use as the row key |
In case, if input table contains composite(复合) | |
key, then <col> must be in the form of a | |
comma-separated(逗号分隔) list of composite key | |
attributes | |
--hbase-table <table-name> |
Specifies an HBase table to use as the target instead of HDFS |
--hbase-bulkload |
Enables bulk loading 指导入 |
- bin/sqoop import --connect jdbc:mysql://yangxw:3306/classicmodels --username root --password root --table orders --target-dir /mysql_hadoop/orders4 --hbase-table orders --column-family orders --hbase-create-table
- 报以下错误:无法创建hbase的表:
16/03/24 18:30:23 INFO mapreduce.HBaseImportJob: Creating missing HBase table orders
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.hadoop.hbase.HTableDescriptor.addFamily(Lorg/apache/hadoop/hbase/HColumnDescriptor;)V
at org.apache.sqoop.mapreduce.HBaseImportJob.jobSetup(HBaseImportJob.java:222)
at org.apache.sqoop.mapreduce.ImportJobBase.runImport(ImportJobBase.java:264)
at org.apache.sqoop.manager.SqlManager.importTable(SqlManager.java:673)
at org.apache.sqoop.manager.MySQLManager.importTable(MySQLManager.java:118)
at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:497)
at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:605)
at org.apache.sqoop.Sqoop.run(Sqoop.java:143)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:179)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:218)
hbase(main):002:0> create 'orders','CF1'
0 row(s) in 1.6730 seconds
=> Hbase::Table - orders
bin/sqoop import --connect jdbc:mysql://yangxw:3306/classicmodels --username root --password root --table orders --target-dir /mysql_hadoop/orders5 --hbase-table orders --column-family CF1
sqoop-1.4.6安装与使用的更多相关文章
- Sqoop 1.99.4 安装
1.安装准备工作:已经装好的 hadoop 环境是 hadoop-2.5.1 64位下载的sqoop安装包(注意是hadoop200)http://www.us.apache.org/dist/sqo ...
- [sqoop1.99.7] sqoop入门-下载、安装、运行和常用命令
一.简介 Apache Sqoop is a tool designed for efficiently transferring data betweeen structured, semi-str ...
- HIVE之 Sqoop 1.4.6 安装、hive与oracle表互导
1. sqoop数据迁移 1.1 概述 sqoop是apache旗下一款“Hadoop和关系数据库服务器之间传送数据”的工具. 导入数据:MySQL,Oracle导入数据到Hadoop的HDFS.HI ...
- Sqoop之 Sqoop 1.4.6 安装
1. sqoop数据迁移 1.1 概述 sqoop是apache旗下一款“Hadoop和关系数据库服务器之间传送数据”的工具. 导入数据:MySQL,Oracle导入数据到Hadoop的HDFS.HI ...
- Sqoop 1.99.6 安装和使用
安装 1.安装准备工作: 下载的sqoop安装包 http://mirrors.hust.edu.cn/apache/sqoop/1.99.6/sqoop-1.99.6.tar.gz ...
- sqoop 1.99.7 安装及配置
一 下载sqoop 1.99.7 http://mirror.bit.edu.cn/apache/sqoop/1.99.7/ 二 解压安装文件 三 配置Sqoop 环境变量 最后把mysql的驱动j ...
- Sqoop 1.4.6 安装配置
配置环境变量 # SQOOP SQOOP_HOME=/home/hadoop/development/src/sqoop-1.4.6-cdh5.6.0 PATH=$PATH:$SQOOP_HOME/b ...
- Sqoop(一)安装及基本使用
Sqoop: 1.sqoop从数据库中导入数据到HDFS 2.SQOOP从数据库导入数据到hive 3.sqoop从hive中将数据导出到数据库 sqoop底层还是执行的m ...
- sqoop 1.4.7 安装配置/连接测试
环境: hadoop2.7.7 mysql 8 zk 3.4.10 hive 3 1.上传并解压tar包后进入conf目录 拷贝sqoop-env-template.sh并重命名为sqoop-env. ...
- 安装sqoop
安装sqoop 1.默认已经安装好java+hadoop 2.下载对应hadoop版本的sqoop版本 3.解压安装包 tar zxvf sqoop-1.4.6.bin__hadoop-2.0.4-a ...
随机推荐
- iOS 从零到一搭建组件化项目框架
随着公司业务需求的不断迭代发展,工程的代码量和业务逻辑也越来越多,原始的开发模式和架构已经无法满足我们的业务发展速度了,这时我们就需要将原始项目进行一次重构大手术了.这时我们应该很清晰这次手术的动刀口 ...
- [译文][转载]greenlet:轻量级并发程序
英文原文地址:https://greenlet.readthedocs.io/en/latest/中文翻译转载地址:https://zhuanlan.zhihu.com/p/25188731 背景 g ...
- 如何创建systemd定时任务
1. 如何创建一个定时任务,通过systemd系统 1. 如何创建一个定时任务,通过systemd系统 1.1. systemd中的timer 1.2. 自定义定时任务 1.2.1. 具体步骤 1.2 ...
- ethereum(以太坊)(实例)--"简单的公开竞拍"
说真的,刚开始接触这个竞拍案例--“简单的公开竞拍”,我就抱着简单的心态去查看这个实例,但是自我感觉并不简单.应该是我实力不到家的原因吧!!!233333...不过经过大半天的努力,自己理解完之后,觉 ...
- spark----词频统计(一)
利用Linux系统中安装的spark来统计: 1.选择目录,并创建一个存放文本的目录,将要处理的文本保存在该目录下以供查找操作: ① cd /usr/local ②mkdir mycode ③ cd ...
- 008---vim编辑器
vim 编辑器 三个模式 三个模式之间切换 图 命令模式进入编辑模式 A:行末 a:向后 i:向前 I:行首 o:向上 O:向下 命令模式 复制 yy:复制光标所在行 4yy:向下复制四行 剪切(删除 ...
- 阿里巴巴Java开发手册——速读记录
本随笔基于阿里巴巴Java开发手册V1.2,陆陆续续记录一些现阶段能理解的,有启发的内容,并将持续更新 最佳实践——插件使用已经发布为随笔!http://www.cnblogs.com/jiangbe ...
- LeetCode:49. Group Anagrams(Medium)
1. 原题链接 https://leetcode.com/problems/group-anagrams/description/ 2. 题目要求 给定一个字符串数组,将数组中包含相同字母的元素放在同 ...
- CakePHP模型中使用join的多种写法
Cake写法 App::import("Model","Client"); $this->Client = & new Client(); $th ...
- STM32f469I discovery烧写demo例程
1. 首先安装STM32 ST-Link Utility V3.7,电脑接板子的CN1,然后在STM32 ST-Link Utility V3.7点击连接目标板子(目标-连接),点击External ...