设为首页 加入收藏

TOP

Sqoop   ------- 将mysql的数据导入到hive中
2019-01-11 01:05:13 】 浏览:47
Tags:Sqoop   ------- mysql 数据 导入 hive
版权声明:个人原创,转载请标注! https://blog.csdn.net/Z_Date/article/details/84035052

将数据导入到hive中,但是实际上来说hive中的数据也是在hdfs上进行保存的。在进行导入hive的本质其实就是先把数据导入到hdfs 在从hdfs把数据迁移到hive表所在的hdfs路径

范例:从mysql数据库中导入数据到hive中

sqoop import \
--connect jdbc:mysql://mini3:3306/hive \
--username root \
--password Root123@ \
--table tohdfs \
--hive-import \
--hive-database student \
--hive-table stu_info \
--target-dir /tohdfs3 \
--fields-terminated-by '\t' \
--num-mappers 1 

之后在hive中准备要导入的数据库以及数据表

create database student;

创建数据表,准备接收导入的数据

create table stu_info(id int,name string)
row format delimited fields terminated by '\t';

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇spark on hive原理与环境搭建 &nb.. 下一篇第20天:   嵌套复杂类型

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目