9

我正在尝试将一个简单的工作流程转换为 oozie。我试过浏览 oozie 的例子,但它们有点让人不知所措。实际上,我想运行查询并将结果输出到文本文件。

hive -e 'select * from tables' > output.txt

我如何将它翻译成 oozie 让它每小时运行一次?

4

1 回答 1

7

您的工作流程可能看起来像这样......
workflow.xml

<workflow-app xmlns="uri:oozie:workflow:0.2" name="hive-wf">
    <start to="hive-node"/>
    <action name="hive-node">
        <hive xmlns="uri:oozie:hive-action:0.2">
           <job-tracker>localhost:50001</job-tracker>
            <name-node>hdfs://localhost:50000</name-node>
            <configuration>
                <property>
                    <name>mapred.job.queue.name</name>
                    <value>default</value>
                </property>
                <property>
                    <name>oozie.hive.defaults</name>
                    <value>/user/user1/oozie/hive-site.xml</value>
                </property>
            </configuration>
            <script>script.q</script>
            <param>INPUT_TABLE=SampleTable</param>
            <param>OUTPUT=/user/user1/output-data/hive</param>
        </hive>
        <ok to="end"/>
        <error to="fail"/>
    </action>
    <kill name="fail">
        <message>Hive failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
    </kill>
    <end name="end"/>
</workflow-app>

所以这里的 hive-site.xml 是$HIVE_HOME/conf文件夹中的站点 xml。
script.q 文件包含实际的配置单元查询。select * from ${INPUT_TABLE}.


我们如何以及在哪里使用 OUTPUT 参数?

于 2012-05-09T05:15:26.380 回答