如何通过Sqoop从多个源导入数据 [英] How to import the data from multiple source thru Sqoop

查看:76
本文介绍了如何通过Sqoop从多个源导入数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过Sqoop从多个源导入数据".

"How to import the data from multiple source thru Sqoop".

我对此一无所知..请让我知道它的机制.

I don't have any idea on this..please let me know the mechanism for this.

谢谢

推荐答案

这可以通过Shell脚本来完成.

This can be done by shell script.

1)准备一个包含DBNAME.TABLENAME列表的输入文件.2)shell脚本会将这个文件作为输入,逐行迭代并为每行执行sqoop语句.

1)Prepare a inputfile which has list of DBNAME.TABLENAME 2)The shell script will have this file as input, iterate line by line and execute sqoop statement for each line.

while read line;
do

    DBNAME=`echo $line | cut -d'.' -f1` 
    tableName=`echo $line | cut -d'.' -f2`


    sqoop import -Dmapreduce.job.queuename=$RM_QUEUE_NAME --connect '$JDBC_URL;databaseName=$DBNAME;username=$USERNAME;password=$PASSWORD' --table $tableName  --target-dir $DATA_COLLECTOR/$tableName  --fields-terminated-by '\001'  -m 1 

done<inputFile

这篇关于如何通过Sqoop从多个源导入数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆