2015-06-26 21 views
2

在oozie中可以這樣做嗎?使用「>」通過oozie保存配置單元輸出

hive -f hiveScript.hql > output.txt 

我對上面的代碼下面Oozie的蜂巢行動如下:

<hive xmlns="uri:oozie:hive-action:0.1"> 
       <job-tracker>${jobTracker}</job-tracker> 
       <name-node>${nameNode}</name-node> 
       <configuration> 
        <property> 
         <name>mapred.job.queue.name</name> 
         <value>${queueName}</value> 
        </property> 
       </configuration>   
       <script>hiveScript.hql</script> 
      </hive> 
      <ok to="end" /> 
      <error to="kill" /> 
    </hive> 

我怎麼能告訴腳本,輸出應該去?

回答

3

這對於Oozie來說是不可能的。這是因爲Oozie開始(大部分)它是集羣內節點上的工作流操作。

有了這個,你可以運行Oozie Shell動作來運行hive -f hiveScript.hql > output.txt ...但是這有不同的含義,要求Hive安裝在任何地方,你的hiveScript.hql無處不在,等等。是你的輸出文件將在哪個節點被分配來運行這個shell動作。 https://oozie.apache.org/docs/3.3.0/DG_ShellActionExtension.html

我認爲你最好的選擇是在你的hiveScript.hql文件中包含INSERT OVERWRITE DIRECTORY '/tmp/hdfs_out' SELECT * FROM ...,然後將結果從HDFS中提取出來。

編輯: 我剛想到的另一個選擇是使用SSH操作。 https://oozie.apache.org/docs/3.2.0-incubating/DG_SshActionExtension.html您可以將SSH Action shell潛在您的目標機器上並運行hive -f hiveScript.hql > output.txt