I have an API which creates a file based on user input. I need to distribute this file over a cluster, such that 1 file should be on 1 node only. Can I use zookeeper to achieve this, and how?
A user may want to delete the file. Which means that zookeeper needs to delete the file from the node, when asked to.
I've read through the zookeeper wiki, but it is difficult to understand how/when to use it.
Yes, you can do that using Apache Curator Recipes. Apache Curator is an improved client library for Apache Zookeeper.
You can use zookeeper watch API and Curator's distributed lock to achieve what you want.
Hope you got some idea.