直接将数据流式传输到hdfs而不需要复制 [英] Stream data into hdfs directly without copying

查看:131
本文介绍了直接将数据流式传输到hdfs而不需要复制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找不同的选项,通过这些选项我可以直接使用python将数据写入hdfs,而无需存储在本地节点上,然后使用copyfromlocal。

I am looking for different options through which I can write data directly into hdfs using python without storing on the local node and then using copyfromlocal.

我想使用类似于本地文件的hdfs文件,并使用write方法,将行作为参数,如下所示:

I would like to use hdfs file similar to local file and use write method with the line as the argument, something of the following:

   hdfs_file = hdfs.create("file_tmp")
   hdfs_file.write("Hello world\n")



<

Does there exist something similar to the use case described above?

推荐答案

我不确定一个python hdfs库,但是你有一些类似于上面描述的用例吗?可以始终通过hadoop fs put命令进行流式处理,并使用' - '作为源文件名来表示从stdin复制:

Im not sure about a python hdfs library, but you can always stream via a hadoop fs put command and denote copying from stdin using '-' as the source filename:

hadoop fs -put - /path/to/file/in/hdfs.txt

这篇关于直接将数据流式传输到hdfs而不需要复制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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