标签:select app check term 大数 mysql seconds isa inf
1、在MySQL中新建表stu,插入一些数据
-------------------------------------------------------
2、将MySQL表的stu中的数据导入到hive中
----------------------------------------------------------
[root@bigdata113 ~]# sqoop import --connect jdbc:mysql://bigdata113:3306/mysqlhdfs --username root --password 000000 --table stu --delete-target-dir --num-mappers 1 --hive-import --fields-terminated-by "\t" --hive-overwrite --hive-table stu_hive
hive (default)> select * from stu_hive;
OK
stu_hive.id stu_hive.name
1 zhangsan
2 isi
3 wangwu
4 yiliu
5 lisa
Time taken: 0.491 seconds, Fetched: 5 row(s)
----------------------------------------------------------------
3、往MySQL表stu中添加新数据
----------------------------------------------
4、将MySQL表stu新增的数据追加到hive的stu_hive中
-------------------------------------------
[root@bigdata113 ~]# sqoop import --connect jdbc:mysql://bigdata113:3306/mysqlhdfs --username root --password 000000 --table stu --num-mappers 1 --fields-terminated-by "\t" --target-dir /user/hive/warehouse/stu_hive --check-column id --incremental append --last-value 5
hive (default)> select * from stu_hive;
OK
stu_hive.id stu_hive.name
1 zhangsan
2 isi
3 wangwu
4 yiliu
5 lisa
6 xiaohei
Time taken: 0.091 seconds, Fetched: 6 row(s)
标签:select app check term 大数 mysql seconds isa inf
原文地址:https://www.cnblogs.com/jeff190812/p/11627269.html