300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > hive sqoop 分区导入_利用oozie 执行sqoop action将DB2中的数据导入到hive分区表中

hive sqoop 分区导入_利用oozie 执行sqoop action将DB2中的数据导入到hive分区表中

时间:2020-10-22 19:37:49

相关推荐

hive sqoop 分区导入_利用oozie 执行sqoop action将DB2中的数据导入到hive分区表中

测试:利用oozie,执行sqoop action将DB2中的数据导入到hive分区表中。

需要注意的地方:

1,要添加hive.metastore.uris这个参数。否则无法将数据加载到hive表中。并且,如果一个xml文本中有多个这种操作的话,每个action中都需要配置这个参数。

2,要注意XML中的转义字符问题。这里我的sql中,就有一个小于号需要重写,否则执行后会说sql语句不对。

3,因为是分区表,按照每日分区,所以要从系统获取系统时间。这里没找到其他的可执行的方法,就比较麻烦的写成了这个样子:${replaceAll(timestamp(),"T.{0,}","")}

4,还要注意xmlns的版本问题。这个时候,多试几个就好了。

workflow.xml

hive.metastore.uris

thrift://192.168.20.39:9083

import

--connect

jdbc:db2://192.168.20.236:50001/sample

--username

db2inst1

--password

zheshimima

--query

select projno,projname,prstdate from project where prstdate<date(current date)-1 day and $CONDITIONS

--fields-terminated-by

"\t"

--hive-import

--target-dir

/qpf/target-dir/

--hive-table

ceshiku.tb_db2test

--null-string

"\\N"

--null-non-string

"\\N"

--hive-partition-key

shijian

--hive-partition-value

"${replaceAll(timestamp(),"T.{0,}","")}"

-m

1

Action failed,step01 error message[${wf:errorMessage(wf:lastErrorNode())}]

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。