简体   繁体   English

Oozie将文件从一个HDFS位置复制到另一个位置

[英]Oozie Copy files from one hdfs location to another

I am using oozie fs move option to copy data from one hdfs folder to another. 我正在使用oozie fs move选项将数据从一个hdfs文件夹复制到另一个。 However if the target exists the fs command places source as a child of the target directory as expected. 但是,如果目标存在,则fs命令按预期将source放置为目标目录的子目录。 Is there a way to avoid this and copy only avro files from source to target. 有没有一种方法可以避免这种情况,并且仅将avro文件从源复制到目标。

if you have to overwrite a directory you can use -f example : hdfs dfs -cp -f /sourcepath /Destination path You can reflect the same way in oozie. 如果必须覆盖目录,则可以使用-f示例: hdfs dfs -cp -f /sourcepath /Destination path您可以在oozie中反映相同的方式。

If you want to only copy the Avro files pick the common extension for the avro files and use the wild care, something like this hdfs dfs -cp -f sourcepath/*.avro /Destnation_path 如果您只想复制Avro文件,请为avro文件选择通用扩展名并使用百搭保管,例如以下hdfs dfs -cp -f sourcepath/*.avro /Destnation_path

There is no straight way to override the folder from oozie fs, you should delete the folder first and move that way you will not have the child directories 没有直接的方法可以从oozie fs覆盖该文件夹,您应该首先删除该文件夹,然后再进行移动,这样就不会再有子目录了

<workflow-app name="[WF-DEF-NAME]" xmlns="uri:oozie:workflow:0.1">
...
<action name="[NODE-NAME]">
    <fs>
        <delete path='[PATH]'/>
        ...
        <mkdir path='[PATH]'/>
        ...
        <move source='[SOURCE-PATH]' target='[TARGET-PATH]'/>
        ...
        <chmod path='[PATH]' permissions='[PERMISSIONS]' dir-files='false' />
        ...
    </fs>
    <ok to="[NODE-NAME]"/>
    <error to="[NODE-NAME]"/>
</action>
...

Please refer the oozie documentation for more info on that. 请参考oozie文档以获取更多信息。

Hope this help, comment on the answer if you have any questions. 希望有帮助,如果您有任何疑问,请对答案发表评论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM