我是靠谱客的博主 有魅力小霸王,这篇文章主要介绍sqoop将数据导入到hdfs,现在分享给大家,希望可以做个参考。

安装步骤:
1、解压
2、配置环境变量
export SQOOP_HOME=/XX/sqoop.xx
source /etc/profile
3、添加数据库驱动包
cp mysql-connector-java-5.1.10.jar /sqoop-install-path/lib
4、重命名配置文件
mv sqoop-env-template.sh sqoop-env.sh
5、修改配置configure-sqoop
去掉未安装服务相关内容;例如(HBase、HCatalog、Accumulo):
6、测试
sqoop version
sqoop list-databases -connect jdbc:mysql://node3:3306/ -username root -password 123
第一种:
编辑文件sqoop1

sqoop:
导入:

import
--connect
jdbc:mysql://hadoop1:3306/test
--username
root
--password
123
--as-textfile
--columns
id,name,msg
--table
psn
--delete-target-dir
--target-dir
/sqoop/data
-m


命令:
sqoop --options-file sqoop1
导入:

import
--connect
jdbc:mysql://hadoop1/test
--username
root
--password
123
--as-textfile
--query
'select id, name, msg from psn where id like "1%" and $CONDITIONS'
--delete-target-dir
--target-dir
/sqoop/tmp
-m
1
--hive-home
/home/hive-1.2.1
--hive-import
--create-hive-table
--hive-table
t_test

最后

以上就是有魅力小霸王最近收集整理的关于sqoop将数据导入到hdfs的全部内容,更多相关sqoop将数据导入到hdfs内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(151)

评论列表共有 0 条评论

立即
投稿
返回
顶部