本文介绍了将文件放在HDFS上,并使用空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为文件名(1).zip 的文件(其中有空格和括号),我想把这个文件放在HDFS上。但每次尝试通过 hadoop fs -put ... 时,我都会遇到异常。

I have a file named file name(1).zip (with the space and parentheses in it) and I want to put this file on the HDFS. But everytime I try to put it via hadoop fs -put ... , I get a an exception.

我甚至试图在文件中添加引号,甚至尝试转义空格和括号,但它无效。

I have even tried to add quotes around the file and even tried to escape the space and parentheses but it doesn't work.

hduser@localhost:/tmp$ hadoop fs -put file\ name\(1\).zip /tmp/one
15/06/05 15:57:46 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
put: unexpected URISyntaxException

hduser@localhost:/tmp$ hadoop fs -put "file\ name\(1\).zip" /tmp/one/
15/06/05 15:59:19 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
put: unexpected URISyntaxException

hduser@localhost:/tmp$ hadoop fs -put "file name(1).zip" /tmp/one/
15/06/05 16:00:36 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
put: unexpected URISyntaxException

有没有办法将这些文件放在HDFS上,或者我在这里丢失了一些东西。

Is there any work-around to put such files on the HDFS or am I missing something here.

推荐答案

最明显的解决方法是在将文件存储到HDFS之前重命名该文件,难道你不这么想吗?

The most obvious workaround is to rename the file before storing it on HDFS, don't you think?

这篇关于将文件放在HDFS上,并使用空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 05:13