Apache Nifi 解压 [英] Apache Nifi decompression

查看:38
本文介绍了Apache Nifi 解压的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Apache NIFI 的新手,正在尝试将流程构建为 POC.我需要你的指导.

I'm new to Apache NIFI and trying to build a flow as a POC. I need your guidance for the same.

我有一个名为sample.gz"的压缩gz"文件,其中包含一个名为sample_file"的文件.我需要解压缩 sample.gz 文件并将sample_file"存储在 hdfs 位置.

I have a compressed 'gz' file say 'sample.gz' containing a file say 'sample_file'. I need to decompress the sample.gz file and store 'sample_file' in a hdfs location.

我使用 GetFile 处理器获取 sample.gz 文件,使用 CompressContent 处理器在解压模式下解压相同的文件,使用 PutHDFS 处理器将解压后的文件放在 HDFS 位置.

I'm using GetFile processor to get the sample.gz file, CompressContent processor in decompress mode to decompress the same file and PutHDFS processor to put the decompressed file in HDFS location.

运行流程后,我发现原始 sample.gz 文件仅复制到 HDFS 位置,而我需要将 sample_file 复制到 gz 文件中.所以解压实际上对我不起作用.

After running the flow, I can find that the original sample.gz file is only copied to HDFS location whereas I needed to copy the sample_file inside the gz file. So decompressing has actually not worked for me.

我希望我能解释我面临的问题.请建议我是否需要改变我的方法.

I hope I could explain the issue I'm facing. Please suggest if I need to change my approach.

推荐答案

我使用了相同的处理器序列,但将 PutHDFS 更改为 PutFile.

I used the same sequence of processors but changed PutHDFS to PutFile.

GetFile --> CompressContent(decompress) --> PutFile

在 nifi v1.3.0 中它工作正常.

In nifi v1.3.0 it works fine.

唯一的注意事项:如果我保留参数 Update Filename = false for CompressContent 那么 filename 属性在解压后保持不变之前 (sample.gz).

The only note: if I keep the parameter Update Filename = false the for CompressContent then the filename attribute remains the same after decompression as before (sample.gz).

但是内容被解压了.

因此,如果您对文件名有疑问,则:

So, if your question about the filename then:

  1. 您可以通过在CompressContent 处理器中设置参数Update Filename = true 来更改.在这种情况下,sample.gz 将在解压过程中更改为 sample.
  2. 使用UpdateAttribute 处理器来改变filename 属性
  1. you can change by setting parameter Update Filename = true in CompressContent processor. in this case sample.gz will be changed to sample during decompression.
  2. use UpdateAttribute processor to change the filename attribute

这篇关于Apache Nifi 解压的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆