sqoop路径:/opt/module/sqoop

把指定文件放到hadoop指定路径:hadoop fs -put stu1.txt /user/hive/warehouse/stu

hive启动(/opt/module/hive):bin/hive

测试流程:

①hive路径下建表:test1

 

create table test1

(InvoiceNo String, StockCode String, Description String, Quantity String, InvoiceDate String, UnitPrice String, CustomerID String, Country String)

ROW format delimited fields terminated by ',' STORED AS TEXTFILE;

 

②导入数据:

 

load data local inpath '/opt/module/data/ AA_GXJSQYDC2019.xlsx' into table QX_test;

 

显示数据:select * from test1;

③进入mysql:mysql -uroot -p000000

(创建表命令:create database company;)

(进入对应数据库命令:use company;)

④将汇总结果导出到MySQL:

1.建表(可视化建表):

2.sqoop路径下:

bin/sqoop export \

> --connect jdbc:mysql://master:3306/mysql \

> --username root \

> --password 000000 \

> --table aa2\

> --num-mappers 1 \

> --export-dir /user/hive/warehouse/aa2 \

> --input-fields-terminated-by ","