Heim  >  Artikel  >  Datenbank  >  MySQL向Hive/HBase的迁移工具

MySQL向Hive/HBase的迁移工具

WBOY
WBOYOriginal
2016-06-07 16:26:15994Durchsuche

Apache Hive是目前大型数据仓库的免费首选产品之一,使用Apache Hive的人是不会期望在小数据量上做什么文章,例如把MySQL中的数据搬到Hive/HBase中去,那样的话原先很快能执行完毕的SQL,估计在Hive上运行跟原来相比时间延长10倍都不止。但如果你有MySQL数据

   Apache Hive是目前大型数据仓库的免费首选产品之一,使用Apache Hive的人是不会期望在小数据量上做什么文章,例如把MySQL中的数据搬到Hive/HBase中去,那样的话原先很快能执行完毕的SQL,估计在Hive上运行跟原来相比时间延长10倍都不止。但如果你有MySQL数据可以把大量的数据向Hive导入,如果上亿条的数据量再加上复杂的SQL查询条件对于MySQL来说是一件比较头疼的事情,此时相比而言对于Hive来说还算比较easy没有那么非常的头痛,但是两者之间缺少一个沟通的桥梁。

                                              http://public.bay.livefilestore.com/y1p60OKte_dOFw7ZYaJxmWbVsmeD9khYFhlFKAFPqOg1Tg1utFKgemKSCsvkBOkvJMnU73WqnN_HXypPGmLo6oJtw/mysql-sqoop-hive.png?psid=1

而然伟大的云计算公司cloudera.com也是Hadoop强力支持者推出了Sqoop,Sqoop顾名思义SQL-to-Hadoop,在sqoop中通过 ManagerFactory 抽象类对多种数据库类型进行了抽象,可以做到 Hsqldb、MySQL、Oracle、PostgreSQL 这些数据库中的数据可以向Hive中写入。
http://public.bay.livefilestore.com/y1pKunc2kOxZ0w1tVFtqFGKBJhHLXyhqCi3OgRu4r_KCnGR4OEnxHeXiZHJwCLwnIwoeTV-yLxROi-2n_3mBiD0HA/mysql-sqoop-hive-2.png?psid=1

   从导出/导入所有数据一条命令即可,而且可以对表和数据的筛选,开发的效率提升和配置的简洁是这个工具的特色所在,同样的机器配置、机器数量、数据量和数据内容,但是换了不同的环境得到了不同的执行效率,通过对RMDBS到Hadoop的迁移,带来了性能的提升,所以就体现了sqoop的价值。

在一次开发大会上提到的Sqoop主要功能
    JDBC-based implementation
        ? Works with many popular database vendors
    Auto-generation of tedious user-side code
        ? Write MapReduce applications to work with your data, faster
    Integration with Hive
        ? Allows you to stay in a SQL-based environment
    Extensible backend
        ? Database-specific code paths for better performance

http://public.bay.livefilestore.com/y1pKunc2kOxZ0y2Pt8yOPnxCxLDqYhdKYcnyzq0g3mYjyyat1WZPHAyA4tWkH2DR7rYwENP9xdRVb8XTmOczMsx6Q/mysql-sqoop-hive-1.png

具体操作手册相见:
http://archive.cloudera.com/cdh/3/sqoop/SqoopUserGuide.html (官方)

相关文章:
 Hive入门3–Hive与HBase的整合
 Apache Hive入门2
 Apache Hive入门1
 Apache Pig入门1 –介绍/基本架构/与Hive对比

–end–

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn