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 是换个方向。

相关推荐
姬激薄11 小时前
HDFS概述
大数据·hadoop·hdfs
多多*12 小时前
Java反射 八股版
java·开发语言·hive·python·sql·log4j·mybatis
yyf96012615 小时前
hiveserver2与beeline进行远程连接hive配置及遇到的问题
数据仓库·hive
yyf96012615 小时前
hive在配置文件中添加了hive.metastore.uris之后进入hive输入命令报错
hive
jiedaodezhuti16 小时前
hive两个表不同数据类型字段关联引发的数据倾斜
数据仓库·hive·hadoop
IvanCodes16 小时前
五、Hive表类型、分区及数据加载
大数据·数据仓库·hive
静听山水2 天前
Hive JOIN 优化策略详解
hive
Microsoft Word2 天前
数据仓库Hive
数据仓库·hive·hadoop
IvanCodes2 天前
四、Hive DDL表定义、数据类型、SerDe 与分隔符核心
大数据·hive·hadoop
IvanCodes2 天前
三、Hive DDL数据库操作
大数据·数据库·hive·hadoop