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())}]
總結
以上是生活随笔為你收集整理的hive sqoop 分区导入_利用oozie,执行sqoop action将DB2中的数据导入到hive分区表中的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: shell linux教程,Shell入
- 下一篇: php send helo/ehlo f