使用sqoop将数据从mysql导入到hive

参考文档:https://segmentfault.com/a/1190000002532293
测试环境:
完全分布式安装Hadoop
Hive安装(使用默认的derby存储元数据)
sqoop的安装
当然还是mysql已安装(使用iso文件建立本地仓库)

测试数据

MariaDB [(none)]> use testdb;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [testdb]> select * from emp;
+------+---------+--------------+--------+------+
| id   | name    | deg          | salary | dept |
+------+---------+--------------+--------+------+
| 1201 | gopal   | manmager     | 50000  | TP   |
| 1202 | manisha | Proof reader | 50000  | TP   |
| 1203 | kalil   | php dev      | 50000  | TP   |
+------+---------+--------------+--------+------+
3 rows in set (0.00 sec)

MariaDB [testdb]> 

导入数据

[root@master conf]# sqoop import --connect jdbc:mysql://localhost:3306/testdb --username root --password 000000 --table emp --fields-terminated-by '\t' --lines-terminated-by "\n" --hive-import --hive-overwrite --create-hive-table --hive-table emp --delete-target-dir
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容