Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

nifi move json data between hdfs directories

avatar
Explorer

Hi All,

 

I am moving data between hdfs directories to pick the latest updated flow file. The requirement is to move the merged json files. The code should verify on the source hdfs directories to pick the json files and process to the target along with the sub folders if the target directory doesn't have the directories available.

Source hdfs path:-

  • /data/json/incoming/year=1970/month=01/day=18/$flow-file

Target hdfs path:-

  • /data/json/final/$path/$flow-file

I am currently using listhdfs->updateattribute->movehdfs

In update attribute I have provided 

property(filename): ${path}.substringAfterLast("/")

path: ${filename:substringBeforeLast('/')}

 

Movehdfs output directory has 

Output Directory - /data/json/final/${path}

 

Could you please verify the flow and help to resolve the issue as I am unable to pull the files into target using movehdfs along with copying the sub-folders if it not already present.

 

1 ACCEPTED SOLUTION

avatar
Explorer

This has to be achieved only with puthdfs and not movehdfs.

The following nifi flow worked and issue resolved.

 listhdfs->updateattribute->puthdfs->deletehdfs

View solution in original post

1 REPLY 1

avatar
Explorer

This has to be achieved only with puthdfs and not movehdfs.

The following nifi flow worked and issue resolved.

 listhdfs->updateattribute->puthdfs->deletehdfs