使用sqoop将数据从mysql导入到hdfs

参考文档:http://www.yiibai.com/sqoop/sqoop_import.html
实验前提:

MariaDB [(none)]> use testdb;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [testdb]> select * from emp
    -> ;
+------+---------+--------------+--------+------+
| id   | name    | deg          | salary | dept |
+------+---------+--------------+--------+------+
| 1201 | gopal   | manmager     | 50000  | TP   |
| 1202 | manisha | Proof reader | 50000  | TP   |
+------+---------+--------------+--------+------+
2 rows in set (0.00 sec)

导入数据:

sqoop import --connect jdbc:mysql://localhost/testdb --username root --password 000000 --table emp -m 1

验证数据:

[root@master bin]# hadoop fs -cat /user/root/emp/*
1201,gopal,manmager,50000,TP
1202,manisha,Proof reader,50000,TP
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,491评论 19 139
  • 原文地址 http://www.cnblogs.com/wgp13x/p/5028220.html基础环境sqoo...
    我是Mr小赵先生阅读 9,029评论 0 10
  • Apache Sqoop 概述 使用Hadoop来分析和处理数据需要将数据加载到集群中并且将它和企业生产数据库中的...
    和心数据阅读 5,123评论 0 8
  • 在这个假期里,我供阅读了29本书,分别是《悲情豹母》15.5万,《云豹生死恋》12万,《八月桂花》12万,《秃尾...
    谁饮孤独阅读 2,880评论 0 0
  • 现在做人难,真难,难于上青天!关心吧,说你查问道是;不问吧,说你不关心!如果帮忙出主意,好事,没你的份;如果...
    苗老师阅读 1,014评论 0 0