1. 程式人生 > >SQOOP從Oracle匯入資料到Hive時hang up在MapReduce作業過程

SQOOP從Oracle匯入資料到Hive時hang up在MapReduce作業過程

打算從Oracle一個模式中匯入資料到Hive,打算匯入的資料都存在視圖裡。

其他幾個檢視的匯入過程都很順利,有一個小坑是如果沒有設定split-by column選項,只能用一個mapper(--num-mappers 1)。

基本語句為

sqoop import --hive-import --connect jdbc:oracle:thin:@//192.168.1.1:1521/orcl --username XXX --password XXX -m 1 --table DB.VIEW --as-textfile --hive-overwrite --create-hive-table --fields-terminated-by \\t --hive-table database.table --null-string '\\N' --null-non-string '\\N';

但是有一個任務在執行MR時候一直卡死,狀態是:

 INFO [IPC Server handler 23 on 50949] org.apache.hadoop.mapred.TaskAttemptListenerImpl: Progress of TaskAttempt attempt_1474343967582_0462_m_000000_0 is : 0.0

INFO [IPC Server handler 26 on 50949] org.apache.hadoop.mapred.TaskAttemptListenerImpl: Progress of TaskAttempt attempt_1474343967582_0462_m_000000_0 is : 0.0 INFO [IPC Server handler 25 on 50949] org.apache.hadoop.mapred.TaskAttemptListenerImpl: Progress of TaskAttempt attempt_1474343967582_0462_m_000000_0 is : 0.0

完成一直是0.0。

後來看了下資料庫,發現這個檢視中有一列需要從其他表抽取資料並經過大量計算。

結果選擇除了這個列以外的列進行匯入,任務順利跑完。

最後把這個檢視需要大量計算的列放到Hive裡去跑。