小标
2019-02-20
来源 :
阅读 1002
评论 0
摘要:本文主要向大家介绍了【云计算】Sqoop数据导入,通过具体的内容向大家展现,希望对大家学习云计算有所帮助。
本文主要向大家介绍了【云计算】Sqoop数据导入,通过具体的内容向大家展现,希望对大家学习云计算有所帮助。

1.普通导入
sqoop import \
--connect jdbc:mysql://localhost:3306/mysql \
--username root \
--password 123456 \
--table help_keyword \
-m 1
2.指定分隔符和导入路径
sqoop import \
--connect jdbc:mysql://localhost:3306/mysql \
--username root \
--password 123456 \
--table help_keyword \
--target-dir /user/centos/my_help_keyword \
--fields-terminated-by '\t' \
-m 1
3.导入 where 条件数据
sqoop import \
--connect jdbc:mysql://localhost:3306/mysql \
--username root \
--password 123456 \
--where "name='DATE' " \
--table help_keyword \
--target-dir /user/centos/my_help_keyword01 \
-m 1
4.导入 Query 结果数据
sqoop import \
--connect jdbc:mysql://localhost:3306/mysql \
--username root \
--password 123456 \
--target-dir /user/centos/my_help_keyword02 \
--query 'select help_keyword_id,name from help_keyword WHERE name = "STRING" and
$CONDITIONS' \
--split-by help_keyword_id \
--fields-terminated-by '\t' \
-m 1
sqoop import \
--connect jdbc:mysql://hadoop02:3306/mysql \
--username root \
--password root \
--target-dir /user/hadoop/myimport22 \
--query "select help_keyword_id,name from help_keyword WHERE name = 'STRING' and
\$CONDITIONS" \
--split-by help_keyword_id \
--fields-terminated-by '\t' \
-m 1
导入 MySQL 到 HIVE
sqoop import \
--connect jdbc:mysql://localhost:3306/mysql \
--username root \
--password 123456 \
--table help_relation \
--hive-import \
-m 1
sqoop import \
--connect jdbc:mysql://localhost:3306/mysql \
--username root \
--password root \
--table help_keyword01 \
--fields-terminated-by "\t" \
--lines-terminated-by "\n" \
--hive-import \
--hive-overwrite \
--create-hive-table \
--hive-table mydb_test.new_help_keyword \
--delete-target-dir
增量导入
sqoop import \
--connect jdbc:mysql://hadoop02:3306/mysql \
--username root \
--password root \
--table help_keyword \
--target-dir /user/hadoop/myimport3 \
--incremental append \
--check-column help_keyword_id \
--last-value 500 \
-m 1
导入 MySQL 数据到 HBase
sqoop import \
--connect jdbc:mysql://localhost:3306/mysql \
--username root \
--password 123456 \
--table help_keyword \
--hbase-table new_help_keyword \
--column-family person \
--hbase-row-key help_keyword_id
本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注职坐标大数据云计算大数据安全频道!
喜欢 | 0
不喜欢 | 0
您输入的评论内容中包含违禁敏感词
我知道了

请输入正确的手机号码
请输入正确的验证码
您今天的短信下发次数太多了,明天再试试吧!
我们会在第一时间安排职业规划师联系您!
您也可以联系我们的职业规划师咨询:
版权所有 职坐标-一站式AI+学习就业服务平台 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
沪公网安备 31011502005948号