sqoop导数据总结

本文介绍使用Sqoop工具从MySQL数据库迁移数据到Hadoop生态系统的多种方式,包括HDFS、HBase和Hive等,并提供了具体的命令示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.MySQL ==》HDFS:
sqoop import –connect jdbc:mysql://hd03/test –username root –password 123456–table stu –target-dir /user/root/stu
2.向已经存在HDFS目录追加数据
sqoop import –connect jdbc:mysql://hd03/test –username root –password test –table st –append –target-dir /user/test/sqoop

3.mysql ==> Hbase
sqoop import –connect jdbc:mysql://hd03/test –username root –password test –table mt –hbase-create-table –hbase-table mt –column-family cf –hbase-row-key year,month,day,sta_id

4.将关系型数据的表结构复制到hive中
sqoop create-hive-table –connect jdbc:mysql://localhost:3306/test –table username –username root –password 123456 –hive-table test
5.MySQL ==》hive:
sqoop import –connect jdbc:mysql://localhost:3306/test –username root –password mysql-password –table t1 –hive-import

6.hive ==> mysql:
sqoop export –connect jdbc:mysql://localhost:3306/test –username root –password root –table testa –export-dir /user/hive/warehouse/testa –input-fields-terminated-by ‘\001’
7.hive ==> hbase

8.hbase ==> mysql
没有这样的命令,可以先把hbase里数据导入到HDFS,再将数据导出到MySQL

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值