带存档操作的Oozie工作流程

时间:2015-03-19 14:30:45

标签: hadoop hdfs archive oozie

我想制作一个oozie工作流程,成功的最后一步将是" Archive"结果。

shell中的命令是

hadoop archive -archiveName=XXX.har -p /some/random/parent directorToArhive pathToArchiveDestination

我试过以下

<workflow-app name="HARD_CODED_ARCHIVE_TEST" xmlns="uri:oozie:workflow:0.4">

    <start to="archive"/>
    <action name="archive">
        <archive archiveName="xxx.har" src="/root/src/dir" dest="/path/to/desired/archive/location"/>
        <ok to="end"/>
        <error to="kill"/>
    </action>

    <kill name="kill">
        <message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
    </kill>
    <end name="end"/>
</workflow-app>

我得到的错误类似于以下内容:

WARNING: Exception in Runloop of thread: main with message: E0701: XML schema error, cvc-complex-type.2.4.a: Invalid content was found starting with element 'archive'. One of '{"uri:oozie:workflow:0.4":map-reduce, "uri:oozie:workflow:0.4":pig, "uri:oozie:workflow:0.4":sub-workflow, "uri:oozie:workflow:0.4":fs, "uri:oozie:workflow:0.4":java, WC[##other:"uri:oozie:workflow:0.4"]}' is expected.

所以很明显我无法做到这一点。因为oozie工作流架构不支持&#34; archive&#34;行动。

我真的不想通过cron运行它,因为我想在工作流成功完成后立即存档我该怎么做。

1 个答案:

答案 0 :(得分:3)

试试这个:

<action name="archive"> <java> <job-tracker>${jobTracker}</job-tracker> <name-node>${nameNode}</name-node> <main-class>org.apache.hadoop.tools.HadoopArchives</main-class> <arg>-archiveName</arg> <arg>${YourArchiveName}.har</arg> <arg>-p</arg> <arg>${FilesParentDirectory}</arg> <arg>${SrcDirectory}</arg> <arg>${DestDirectory}</arg> </java> <ok to="end"/> <error to="error"/> </action>

您需要的只是工作流程中的hadoop-archives.jar文件。也不要忘记将jar放在工作流目录中,你应该好好去。希望有所帮助!