Sqoop1 与 Sqoop2

Sqoop即SQL to Hadoop,是一款方便的在RDBMS数据库(如Oracle,MySQL,Postgresql等)与Hadoop之间进行数据迁移的工具,它充分利用MapReduce并行特点以批处理的方式加快数据传输,目前主要包括两个版本:Sqoop1和Sqoop2。Sqoop是Hadoop下连接关系型数据库和Hadoop的桥梁,支持关系型数据库和Hive、HDFS、HBase之间的数据导入导出。Sqoop官方网址: http://sqoop.apache.org/#

Sqoop1和Sqoop2是两个完全不兼容的版本,Apache版本:1.4.x(Sqoop1),1.99.x(Sqoop2);CDH版本:Sqoop-1.4.3-cdh4(Sqoop1),Sqoop2-1.99.2-cdh4.5.0(Sqoop2)。

Sqoop1 与 Sqoop2_第1张图片
Sqoop1 与 Sqoop2_第2张图片

Sqoop2与Sqoop1最大的区别在于,Sqoop2引入Sqoop Server,集中化管理connector,提供多种访问方式如 CLI,Web UI,Rest API,引入基于角色的安全机制。下面是Sqoop1和Sqoop2的架构图,

Sqoop1 与 Sqoop2_第3张图片

Sqoop1 与 Sqoop2_第4张图片

CDH5下安装并使用Sqoop2
1 安装Sqoop2

Sqoop1 与 Sqoop2_第5张图片

这里写图片描述

2 Sqoop CLI 命令尝试
(详细Sqoop命令请参考:http://archive.cloudera.com/cdh5/cdh/5/sqoop2/CommandLineClient.html)

[root@cent-2 bin]# sqoop2
Sqoop home directory: /opt/cloudera/parcels/CDH-5.8.0-1.cdh5.8.0.p0.42/lib/sqoop2
Sqoop Shell: Type 'help' or '\h' for help.

sqoop:000> set server --host cent-1
Server is set successfully
sqoop:000> show connector
0    [main] WARN  org.apache.hadoop.util.NativeCodeLoader  - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
+----+------------------------+-----------------+------------------------------------------------------+----------------------+
| Id |          Name          |     Version     |                        Class                         | Supported Directions |
+----+------------------------+-----------------+------------------------------------------------------+----------------------+
| 1  | kite-connector         | 1.99.5-cdh5.8.0 | org.apache.sqoop.connector.kite.KiteConnector        | FROM/TO              |
| 2  | kafka-connector        | 1.99.5-cdh5.8.0 | org.apache.sqoop.connector.kafka.KafkaConnector      | TO                   |
| 3  | hdfs-connector         | 1.99.5-cdh5.8.0 | org.apache.sqoop.connector.hdfs.HdfsConnector        | FROM/TO              |
| 4  | generic-jdbc-connector | 1.99.5-cdh5.8.0 | org.apache.sqoop.connector.jdbc.GenericJdbcConnector | FROM/TO              |
+----+------------------------+-----------------+------------------------------------------------------+----------------------+
sqoop:000> show version
client version:
  Sqoop 1.99.5-cdh5.8.0 source revision 2e5182fe5475146a2a019f7c44e569cbaee9f915
  Compiled by jenkins on Tue Jul 12 15:44:35 PDT 2016
sqoop:000> show link
+----+------+--------------+----------------+---------+
| Id | Name | Connector Id | Connector Name | Enabled |
+----+------+--------------+----------------+---------+
+----+------+--------------+----------------+---------+
sqoop:000> show job
+----+------+----------------+--------------+---------+
| Id | Name | From Connector | To Connector | Enabled |
+----+------+----------------+--------------+---------+
+----+------+----------------+--------------+---------+

你可能感兴趣的:(大数据,Sqoop)