sqoop导入hdfs,hive

sqoop将mysql中的表导入到hdfs中

复制代码
sqoop import \
> --connect jdbc:mysql://192.168.52.150/test \
> --username root \
> --password 123456 \
> --table emp \
> --delete-target-dir \
> --target-dir '/sqoop_works/emp_1'


将数据导入hive中,首先要在hive中创建目标表

复制代码
create database hivesqoop;
use hivesqoop;
create table hivesqoop.emp_add_hive(
    id int,
    hon string,
    street string,
    city string
)
row format delimited fields terminated by '\t'
stored as orc;

然后导入

复制代码
 sqoop import --connect jdbc:mysql://192.168.52.150/test --username root --password 123456 --table emp_add --hcatalog-database hivesqoop --hcatalog-table emp_add_hive -m 1

将增量数据导入hdfs中

加上 --where id >= 120

hive导出到MySQL 是换个方向。

相关推荐
杨DaB5 小时前
【JavaWeb】Maven、Servlet、cookie/session
hive·servlet·maven
xx155802862xx11 小时前
hive聚合函数多行合并
数据仓库·hive·hadoop
北漂老男孩13 小时前
Hadoop HDFS 体系结构与文件读写流程剖析
大数据·hadoop·hdfs·学习方法
安审若无16 小时前
Hive的存储格式如何优化?
数据仓库·hive·hadoop
北漂老男孩2 天前
Hadoop 大数据启蒙:初识 HDFS
大数据·hadoop·hdfs
viperrrrrrrrrr72 天前
大数据学习(127)-hive日期函数
大数据·hive·学习
北漂老男孩2 天前
Hadoop 大数据启蒙:深入解析分布式基石 HDFS
大数据·hadoop·分布式·hdfs·学习方法
Hadoop_Liang2 天前
Hive自定义函数案例(UDF、UDAF、UDTF)
数据仓库·hive·自定义函数·udf
weixin_472339462 天前
Hive SQL优化实践:提升大数据处理效率的关键策略
hive·hadoop·sql
不辉放弃2 天前
HiveSQL语法全解析与实战指南
数据库·hive·大数据开发