sqoop基本应用

今天了解了一下sqoop的相关知识。

sqoop主要有导入导出两种功能;

导入:导入就是从非大数据集群(RDBMS,如mysql)往大数据集群(hbase,hive,hdfs)里导数据。

主要有:

mysql===>hdfs

mysql===>hive(分两步,mysql===>hdfs,hdfs===>hive)

mysql===>hbase

导出:导出就是从大数据集群往非大数据集群导数据;

主要有:

hdfs/hive===>mysql;

相关语句:

bin/sqoop export -connect jdbc:mysql://hadoop102:3306/sale_simple -username root -password 000000 -table sale3 --fields-terminated-by ',' --export-dir /user/hive/warehouse/sale.db/sale3

 

 

还有就是sqoop脚本导入导出数据,主要是完成定时的任务;

 

bin/sqoop export -connect jdbc:mysql://hadoop102:3306/bs2 -username root -password 000000 -table bs_job_info_result --fields-terminated-by '\0001' --export-dir /user/hive/warehouse/bs2.db/job_info_result

 

insert into table job_info_result select * from bs_job_info where title like '%游戏%' or title like '%产品经理%';

 

create table job_info_result as select * from bs_job_info where title like '%java%' or title like '%Java%';

 

create table job_info_tomysql(title string,job_href string,jobarea string,job_need_tag_list string,salary string,job_info_tag_list string,company_name string,company_tag_list string,company_href string)ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'

 本地导入到hive 通过txt文件

相关链接:(3条消息) 大数据工具之Sqoop上手笔记_ChanZany的博客-CSDN博客

posted @ 2021-10-02 17:42  见怪见外  阅读(62)  评论(0编辑  收藏  举报