# Apache Sqoop

**Apache Sqoop**（SQL-to-Hadoop 的缩略词）曾是一款开源命令行工具，用于在 [Apache Hadoop](https://www.edgepedia.org/zh/apache-hadoop) 与关系数据库、企业数据仓库等结构化数据存储之间传输批量数据。它可将外部数据存储中的表导入 Hadoop 分布式文件系统（HDFS）以及 [Apache Hive](https://www.edgepedia.org/zh/apache-hive)、HBase 等相关系统，也可将 Hadoop 中处理过的数据导出回关系表。<sup>[1](https://attic.apache.org/projects/sqoop.html)</sup><sup> • </sup><sup>[2](https://news.apache.org/foundation/entry/the_apache_software_foundation_announces25)</sup> Apache 软件基金会于 2021 年 6 月将该项目退役，并于 2021 年 7 月完成将其移入 Apache Attic（存放不活跃项目的仓库）。<sup>[1](https://attic.apache.org/projects/sqoop.html)</sup>

| 关键事实 | 详情 |
|---|---|
| 用途 | 在 Hadoop 与结构化数据存储之间批量传输；导入至 HDFS、Hive 和 HBase，导出回关系数据库<sup>[2](https://news.apache.org/foundation/entry/the_apache_software_foundation_announces25)</sup> |
| 起源 | 2009 年 5 月由 Aaron Kimball 作为 HADOOP-5815 的补丁提交，当时是 Hadoop 的 contrib 模块<sup>[3](https://blogsarchive.apache.org/sqoop/entry/apache_sqoop_graduates_from_incubator)</sup> |
| ASF 里程碑 | 2011 年 6 月 13 日进入孵化器；2012 年 3 月 21 日毕业为顶级项目<sup>[4](https://svn.apache.org/repos/infra/websites/production/incubator/content/projects/sqoop.html)</sup> |
| 退役 | 2021 年 6 月退役；2021 年 7 月完成移入 Attic；GitHub 仓库于 2021 年 7 月 9 日归档<sup>[1](https://attic.apache.org/projects/sqoop.html)</sup><sup> • </sup><sup>[5](https://github.com/apache/sqoop)</sup> |
| 最后稳定版本 | Sqoop 1.4.7，2017 年 12 月<sup>[6](https://vbn.aau.dk/ws/portalfiles/portal/400693632/FEDDL_submited_version_Copyright.pdf)</sup> |
| 连接器 | MySQL、PostgreSQL、Oracle、SQL Server 和 DB2，另有面向第三方系统的连接器 API<sup>[2](https://news.apache.org/foundation/entry/the_apache_software_foundation_announces25)</sup> |
| 许可证与语言 | Apache License v2.0；用 Java 编写<sup>[2](https://news.apache.org/foundation/entry/the_apache_software_foundation_announces25)</sup><sup> • </sup><sup>[7](https://ccsenet.org/journal/index.php/mas/article/download/0/0/43572/45733)</sup> |

## 用途与设计

Sqoop 解决了 Hadoop 早期一个普遍存在的问题：日常运营所用数据存放在关系数据库中，而 Hadoop 处理却要求数据位于 HDFS 中。它可将外部结构化数据存储和企业数据仓库中的数据导入 HDFS 或 Hive、HBase 等系统，反过来也可从 Hadoop 中提取数据并导出至关系数据库和数据仓库。<sup>[2](https://news.apache.org/foundation/entry/the_apache_software_foundation_announces25)</sup><sup> • </sup><sup>[3](https://blogsarchive.apache.org/sqoop/entry/apache_sqoop_graduates_from_incubator)</sup> 退役时，其使命被描述为与 Apache Hadoop 及结构化数据存储的批量数据传输相关的软件。<sup>[1](https://attic.apache.org/projects/sqoop.html)</sup>

Sqoop 只移动数据而不转换数据；重塑数据的工作预期在此后由处理框架完成。<sup>[8](https://brilliqs.com/tools/apache-sqoop)</sup> 该工具可与任何提供 JDBC（Java 数据库连接）的关系数据库配合使用，其架构基于连接器、面向批处理，且不是事件驱动的。<sup>[7](https://ccsenet.org/journal/index.php/mas/article/download/0/0/43572/45733)</sup> 导入开始时，Sqoop 首先从源数据库提取元数据；映射器的数量应加以调整，以在性能与数据库所承受的负载之间取得平衡。<sup>[9](https://www.ijsat.org/papers/2020/3/1141.pdf)</sup>

## 并行性与性能控制

**并行导入与导出。** 导出性能取决于并行度。默认情况下，Sqoop 在导出过程中使用四个并行任务；`--num-mappers` 或 `-m` 参数控制映射任务的数量。增加任务可能提高并发性，但如果数据库在更新索引或调用触发器方面已存在瓶颈，额外负载反而可能降低性能。<sup>[10](https://sqoop.apache.org/docs/1.4.5/SqoopUserGuide.html)</sup> 对于导入，分割列将表划分为若干范围，使多个任务可同时读取不同部分；选择值分布均匀的列才能使并行传输有效。<sup>[8](https://brilliqs.com/tools/apache-sqoop)</sup>

**直接模式。** 某些数据库为导入和导出提供直接模式，通过 `--direct` 参数选择，其性能可能高于标准 JDBC 代码路径；例如，MySQL 提供 mysqldump 工具用于快速导出。<sup>[10](https://sqoop.apache.org/docs/1.4.5/SqoopUserGuide.html)</sup><sup> • </sup><sup>[11](https://www.cisco.com/c/dam/en/us/td/docs/net_mgmt/datacenter_mgmt/workload_auto/6-3-3/adapter_guides/Sqoop/SqoopAdapterGuide.pdf)</sup> 直接模式有局限性：它不支持导入 BLOB、CLOB 或 LONGVARBINARY 列，因此涉及此类列时必须使用基于 JDBC 的导入。<sup>[11](https://www.cisco.com/c/dam/en/us/td/docs/net_mgmt/datacenter_mgmt/workload_auto/6-3-3/adapter_guides/Sqoop/SqoopAdapterGuide.pdf)</sup> 在后来的发行版中，Cloudera 建议不要在 Sqoop 导入或导出命令中使用 `--direct` 选项。<sup>[12](https://docs.cloudera.com/cdp-private-cloud-base/7.3.2/private-release-notes/rt-release-notes.pdf)</sup>

**增量导入。** Sqoop 提供增量导入模式，仅检索比先前导入集更新的行。追加模式用于新行不断以递增的行 ID 值添加的情况，通过将导入创建为保存的作业来自动处理重复的增量导入，这是首选机制。<sup>[11](https://www.cisco.com/c/dam/en/us/td/docs/net_mgmt/datacenter_mgmt/workload_auto/6-3-3/adapter_guides/Sqoop/SqoopAdapterGuide.pdf)</sup><sup> • </sup><sup>[10](https://sqoop.apache.org/docs/1.4.5/SqoopUserGuide.html)</sup>

商业部署还提供更多调优参数：用于分组导出 SQL 语句的批处理模式、每次导入条目数的获取大小、压缩以及每个映射器的 Java 内存设置。Informatica 为其 Big Data Management 产品提供的指南建议，小型部署的获取大小为 1,000，大型部署可增至 20,000，映射器数量为 4 到 20。<sup>[13](https://docs.informatica.com/content/dam/source/GUID-1/GUID-175DADAC-C21C-47DD-9D7C-92B0EC0A8F39/1/en/1098_PerformanceTuningAndSizingGuidelinesForInformaticaBigDataManagement102_en_H2L.pdf)</sup>

## 历史

Sqoop 于 2009 年 5 月作为 Apache Hadoop 的 contrib 模块起步，最初由 Aaron Kimball 作为 HADOOP-5815 的补丁提交。在随后的一年里，它收到了约 56 个补丁；Kimball 随后决定将其与 Hadoop 解耦以实现更快的发布周期，2010 年 4 月，Sqoop 通过 MAPREDUCE-1644 从 Hadoop 中移除，并由 Cloudera 以 Apache 许可项目的形式托管在 GitHub 上。那一年它发布了四个版本、收到 191 个补丁，早期的扩展 API 允许供应商为企业数据仓库等专用系统开发高速第三方连接器。<sup>[3](https://blogsarchive.apache.org/sqoop/entry/apache_sqoop_graduates_from_incubator)</sup> 一份 O'Reilly 的项目历史记述将该项目作为 Apache 项目的孵化日期定为 2011 年 7 月 23 日，即代码从 Cloudera 转移完成的日期。<sup>[14](https://www.oreilly.com/library/view/data-lake-for/9781787281349/52baffe4-d8b7-4016-a536-a859aad06035.xhtml)</sup><sup> • </sup><sup>[4](https://svn.apache.org/repos/infra/websites/production/incubator/content/projects/sqoop.html)</sup>

在孵化器内，Sqoop 发布了两个孵化版本：2011 年 11 月的 1.4.0-incubating 和 2012 年 2 月的 1.4.1-incubating。前者侧重于将代码从 com.cloudera.sqoop 命名空间迁移到 org.apache.sqoop，同时保持向后兼容性；后者侧重于与 Hadoop 0.20、0.23 和 1.0 版本的互操作性。Apache 董事会在 2012 年 3 月的会议上授予其顶级项目地位，毕业日期记录为 2012 年 3 月 21 日。<sup>[4](https://svn.apache.org/repos/infra/websites/production/incubator/content/projects/sqoop.html)</sup><sup> • </sup><sup>[3](https://blogsarchive.apache.org/sqoop/entry/apache_sqoop_graduates_from_incubator)</sup>

**Sqoop 1 与 Sqoop 2。** 1.x 系列面临的挑战促成了名为 Sqoop 2 的独立重新设计，以 1.99.* 版本发布。Sqoop 2 架构引入了服务器与客户端分离，配有命令行 shell、REST 接口和用于开发应用程序的 Java 客户端 API，并将工具范围扩展到 HBase、Cassandra 和 HDFS 等半结构化和非结构化数据源以及关系数据库。<sup>[14](https://www.oreilly.com/library/view/data-lake-for/9781787281349/52baffe4-d8b7-4016-a536-a859aad06035.xhtml)</sup><sup> • </sup><sup>[15](https://sqoop2.readthedocs.io/en/latest/)</sup> 计划中的 1.99.6 版本从未出现在项目 wiki 上；该 wiki 上记录的 Sqoop 1 系列最后一个版本是 1.4.5，总体上最后一个稳定版本是 2017 年 12 月的 1.4.7。<sup>[16](https://cwiki.apache.org/confluence/spaces/SQOOP/overview)</sup><sup> • </sup><sup>[6](https://vbn.aau.dk/ws/portalfiles/portal/400693632/FEDDL_submited_version_Copyright.pdf)</sup>

## 退役及后续状态

Sqoop 于 2021 年 6 月退役，2021 年 7 月完成移入 Attic，终止了新版本发布、安全修复和社区支持。<sup>[1](https://attic.apache.org/projects/sqoop.html)</sup><sup> • </sup><sup>[17](https://docs.tecnisys.com.br/tdp/en/commons/sqoop)</sup> ASF GitHub 镜像于 2021 年 7 月 9 日归档，现为只读。<sup>[5](https://github.com/apache/sqoop)</sup> 平台供应商也纷纷跟进：[Amazon EMR](https://www.edgepedia.org/zh/amazon-emr) 最后一个包含 Sqoop 的版本是 Release 7.4，Sqoop 将从 Release 7.5 及更高版本中移除。<sup>[18](https://docs.aws.amazon.com/emr/latest/ReleaseGuide/emr-sqoop.html)</sup>

## 与其他摄取工具的比较

在为丹麦国家能源数据湖编写、发表于 2020 年 IEEE Big Data 的数据收集与摄取工具比较中，Sqoop 与 [Apache NiFi](https://www.edgepedia.org/zh/apache-nifi) 和 [Apache Flume](https://www.edgepedia.org/zh/apache-flume) 在几个方面有所不同：Sqoop 仅支持批量数据，而 NiFi 和 Flume 同时支持流和批处理；Sqoop 的界面仅为命令行，而 NiFi 提供 Web GUI、命令行和 REST API；Sqoop 不执行转换，而 NiFi 支持聚合、过滤行和删除列；Sqoop 的水平扩展能力有限、非分布式、采用存在单点故障的集中式架构，且不支持数据血缘。其数据源和目的地列为 HDFS、JDBC、Hive、HBase、HCatalog 和 Accumulo，预期用例为从 RDBMS 导入数据。<sup>[6](https://vbn.aau.dk/ws/portalfiles/portal/400693632/FEDDL_submited_version_Copyright.pdf)</sup> Cloudera 社区关于这两种工具不同用途的讨论指出，Sqoop 在从关系数据库拉取数据时并行化吞吐量，而 NiFi 通过 JDBC 适配器读取，两者服务于不同的用例，而非直接相互替代。<sup>[19](https://community.cloudera.com/t5/Archives-of-Support-Questions/Are-there-benchmark-results-available-for-NiFi-ingests-from/m-p/134436/highlight/true)</sup> 2020 年对 Sqoop、Flume、NiFi 和 Kafka 的比较同样将 Sqoop 描述为适合来自任何支持 JDBC 的 RDBMS 的批量数据，而 Flume 适合流式数据源，Kafka 适合消息传递。<sup>[7](https://ccsenet.org/journal/index.php/mas/article/download/0/0/43572/45733)</sup>

对于遗留的 Hadoop 部署，Sqoop 在某些当前平台版本中仍然可用，但供应商建议不要将其用于新项目；对于新的云或湖仓平台，它通常不是合适的起点，因为它依赖于已退役的 Hadoop 时代生态系统。<sup>[17](https://docs.tecnisys.com.br/tdp/en/commons/sqoop)</sup><sup> • </sup><sup>[20](https://techyorker.com/introduction-to-apache-sqoop-what-it-did-how-it-worked-and-whether-to-use-it/)</sup>

## References

1. [Apache Sqoop, The Apache Attic](https://attic.apache.org/projects/sqoop.html)
2. [The Apache Software Foundation Announces Apache Sqoop as a Top-Level Project, ASF Blog (April 2, 2012)](https://news.apache.org/foundation/entry/the_apache_software_foundation_announces25)
3. [Apache Sqoop Graduates from Incubator, Apache Sqoop Blog Archive (April 2, 2012)](https://blogsarchive.apache.org/sqoop/entry/apache_sqoop_graduates_from_incubator)
4. [Sqoop Project Incubation Status, Apache Incubator](https://svn.apache.org/repos/infra/websites/production/incubator/content/projects/sqoop.html)
5. [apache/sqoop on GitHub, repository archived July 9, 2021](https://github.com/apache/sqoop)
6. [Ben Hamadou, H., Pedersen, T. B., Thomsen, C. (2020). The Danish National Energy Data Lake: Requirements, Technical Architecture, and Tool Selection. IEEE BigData 2020](https://vbn.aau.dk/ws/portalfiles/portal/400693632/FEDDL_submited_version_Copyright.pdf)
7. [Comparison of Data Ingestion Tools, Modern Applied Science Vol. 14, No. 9 (2020)](https://ccsenet.org/journal/index.php/mas/article/download/0/0/43572/45733)
8. [Apache Sqoop Hadoop Data Transfer, Brilliqs](https://brilliqs.com/tools/apache-sqoop)
9. [Sqoop for data ingestion, IJSAT (2020)](https://www.ijsat.org/papers/2020/3/1141.pdf)
10. [Sqoop User Guide (v1.4.5), sqoop.apache.org](https://sqoop.apache.org/docs/1.4.5/SqoopUserGuide.html)
11. [Tidal Workload Automation 6.3.3 Sqoop Adapter Guide, Cisco](https://www.cisco.com/c/dam/en/us/td/docs/net_mgmt/datacenter_mgmt/workload_auto/6-3-3/adapter_guides/Sqoop/SqoopAdapterGuide.pdf)
12. [Cloudera Runtime 7.3.2 Known Issues](https://docs.cloudera.com/cdp-private-cloud-base/7.3.2/private-release-notes/rt-release-notes.pdf)
13. [Performance Tuning and Sizing Guidelines for Informatica Big Data Management 10.2](https://docs.informatica.com/content/dam/source/GUID-1/GUID-175DADAC-C21C-47DD-9D7C-92B0EC0A8F39/1/en/1098_PerformanceTuningAndSizingGuidelinesForInformaticaBigDataManagement102_en_H2L.pdf)
14. [History of Sqoop, Data Lake for Enterprises, O'Reilly](https://www.oreilly.com/library/view/data-lake-for/9781787281349/52baffe4-d8b7-4016-a536-a859aad06035.xhtml)
15. [Apache Sqoop documentation, sqoop2.readthedocs.io](https://sqoop2.readthedocs.io/en/latest/)
16. [Home, Apache Sqoop wiki, cwiki.apache.org](https://cwiki.apache.org/confluence/spaces/SQOOP/overview)
17. [Apache Sqoop, TDP Docs, Tecnisy](https://docs.tecnisys.com.br/tdp/en/commons/sqoop)
18. [Apache Sqoop, Amazon EMR Release Guide](https://docs.aws.amazon.com/emr/latest/ReleaseGuide/emr-sqoop.html)
19. [Are there benchmark results available for NiFi ingests from relational databases?, Cloudera Community](https://community.cloudera.com/t5/Archives-of-Support-Questions/Are-there-benchmark-results-available-for-NiFi-ingests-from/m-p/134436/highlight/true)
20. [Introduction to Apache Sqoop: What It Did, How It Worked, and Whether to Use It, TechYorker (2026)](https://techyorker.com/introduction-to-apache-sqoop-what-it-did-how-it-worked-and-whether-to-use-it/)

---
*Initially written Oct 26, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Databases and data systems › Data mining, warehousing, and big data › Big data platforms and frameworks

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/apache-sqoop

English original: https://www.edgepedia.org/apache-sqoop
