一、先将mysql一张表的数据用sqoop导入到hdfs

1.1、先在mysql中准备一张测试用的表

mysql> desc user_info;
+-----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| user_name | varchar(50) | YES | | NULL | |
| age | int(11) | YES | | NULL | |
| address | varchar(50) | YES | | NULL | |
+-----------+-------------+------+-----+---------+-------+
4 rows in set (0.14 sec) mysql> select * from user_info;
+------+-----------+------+--------------------+
| id | user_name | age | address |
+------+-----------+------+--------------------+
| 1 | zhangsan | 20 | shenzhen nanshang |
| 2 | lisi | 20 | shenzhen futian |
| 3 | wangwu | 23 | shenzhen luohu |
| 4 | cailiu | 24 | shenzhen guangming |
| 5 | zhuqi | 25 | shenzhen baoan |
| 6 | houba | 26 | shenzhen xili |
| 7 | laojiu | 27 | shenzhen yantian |
+------+-----------+------+--------------------+
7 rows in set (0.00 sec) mysql>

下面 将 user_info表中的前100条数据导 导出来  只要id  user_name和 age 这3个字段,数据存在hdfs 目录 /tmp/sqoop/user_info下。

用sqoop将mysql的数据导入到hive表的更多相关文章

  1. 用sqoop将mysql的数据导入到hive表中

    1:先将mysql一张表的数据用sqoop导入到hdfs中 准备一张表 需求 将 bbs_product 表中的前100条数据导 导出来  只要id  brand_id和 name 这3个字段 数据存 ...

  2. 使用 sqoop 将mysql数据导入到hive表(import)

    Sqoop将mysql数据导入到hive表中 先在mysql创建表 CREATE TABLE `sqoop_test` ( `id` ) DEFAULT NULL, `name` varchar() ...

  3. 11.把文本文件的数据导入到Hive表中

    先在hive里面创建一个表 create table mydb2.t3(id int,name string,age int) row format delimited fields terminat ...

  4. 把HDFS上的数据导入到Hive中

    1. 首先下载测试数据,数据也可以创建 http://files.grouplens.org/datasets/movielens/ml-latest-small.zip 2. 数据类型与字段名称 m ...

  5. 使用sqoop将mysql数据导入到hive中

    首先准备工具环境:hadoop2.7+mysql5.7+sqoop1.4+hive3.1 准备一张数据库表: 接下来就可以操作了... 一.将MySQL数据导入到hdfs 首先我测试将zhaopin表 ...

  6. sqoop学习2(数据导入与导出)

    最近学习了下这个导数据的工具,但是在export命令这里卡住了,暂时排不了错误.先记录学习的这一点吧 sqoop是什么 sqoop(sql-on-hadoop):是用来实现结构型数据(如关系型数据库) ...

  7. 使用pandas把mysql的数据导入MongoDB。

    使用pandas把mysql的数据导入MongoDB. 首先说下我的需求,我需要把mysql的70万条数据导入到mongodb并去重, 同时在第二列加入一个url字段,字段的值和第三列的值一样,代码如 ...

  8. sqoop从mysql导数据到hive报错:Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

    背景 使用sqoop从mysql导数据到hive,从本地服务器是可以访问mysql的(本地服务器是hadoop集群的一个datanode),但是sqoop导数据的时候依然连接不上mysql 报错如下: ...

  9. Talend 将Oracle中数据导入到hive中,根据系统时间设置hive分区字段

    首先,概览下任务图: 流程是,先用tHDFSDelete将hdfs上的文件删除掉,然后将oracle中的机构表中的数据导入到HDFS中:建立hive连接->hive建表->tJava获取系 ...

随机推荐

  1. javaweb防止表单重复提交

    参考孤傲苍狼 https://www.cnblogs.com/xdp-gacl/p/3859416.html 场景一:在网络延迟的情况下让用户有时间点击多次submit按钮导致表单重复提交 场景二:表 ...

  2. vue中在页面渲染完之后获取元素(否则动态渲染的元素获取不到)

    两种方法: 方法一: 使用$nextTick,在异步获得数据之后再获取元素: 方法二: 在then之后再获取该元素: 问题2:vue中监听改变数组的方法: let idx =; this.listIn ...

  3. Go程序语言设计 (艾伦 A. A. 多诺万 著)

    第1章 入门  (已看) 1.1 hello,world package main import "fmt" func main(){ fmt.Println("Hell ...

  4. 短小而精悍的JsvaScript函数

    1. 回到顶部, 使用浏览器的刷新频率 requestAnimationFrame 来实现的 const scrollToTop = () => { const c = document.doc ...

  5. web 前端安全问题

    转载自:https://segmentfault.com/a/1190000006672214?utm_source=weekly&utm_medium=email&utm_campa ...

  6. elasticsearch 镜像使用

    elasticsearch 镜像使用 下载镜像: docker pull elasticsearch:6.5.4 创建容器: docker run -it -p 9200:9200 -p 9300:9 ...

  7. 外观模式face

    5.1 模式优点       外观模式的主要优点如下: (1) 它对客户端屏蔽了子系统组件,减少了客户端所需处理的对象数目,并使得子系统使用起来更加容易.通过引入外观模式,客户端代码将变得很简单,与之 ...

  8. 八、springboot(五)配置定时器

    1.修改启动类 @SpringBootApplication @EnableScheduling public class DemoApplication { public static void m ...

  9. Linux shell 将字符串分割成数组

    原文链接:http://1985wanggang.blog.163.com/blog/static/776383320121745626320/ a="one,two,three,four& ...

  10. linux在线中文手册

    linux在线中文手册 http://linux.51yip.com/ 百度中的百度应用也不错 http://www.baidu.com/s?word=linux%E5%91%BD%E4%BB%A4& ...