Is it possible to save files in Hadoop without saving them in local file system? I would like to do something like shown below however I would like to save file directly in HDFS. At the moment I save files in documents directory and only then I can save them in HDFS for instance using hadoop fs -put
.
class DataUploadView(GenericAPIView):
def post(self, request):
myfile = request.FILES['photo']
fs = FileSystemStorage(location='documents/')
filename = fs.save(myfile.name, myfile)
local_path = 'my/path/documents/' + str(myfile.name)
hdfs_path = '/user/user1/' + str(myfile.name)
run(['hadoop', 'fs', '-put', local_path, hdfs_path], shell=True)