我想做一个oozie工作流,成功的最后一步是“归档”结果。
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工作流模式不支持“归档”操作。
我真的不想通过cron运行它,因为我想在工作流成功完成后立即存档我该怎么做。
1条答案
按热度按时间n1bvdmb61#
试试这个:
<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放在你的工作流程目录中,你应该准备好了。希望有帮助!