欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

Hadoop streaming: Exception in thread main java.io.IOException: No space left on device

发布时间:2025/4/5 编程问答 44 豆豆
生活随笔 收集整理的这篇文章主要介绍了 Hadoop streaming: Exception in thread main java.io.IOException: No space left on device 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

在使用Hadoop streaming时,遇到报错如标题:

packageJobJar: [mapper_sim.py, reducer_sim.py, XXX files, /tmp/hadoop-unjar2957146529644350496/] [] /tmp/  streamjob2631394570007422828.jar tmpDir=null

Exception in thread "main" java.io.IOException: No space left on device


查看原因,主要是因为,Hadoop streaming时,把需要的文件打包成jar,放在/tmp目录中。在任务较多,并且文件较大的时候,/tmp目录超额,导致no space出错。

查了一圈stackoverflow什么的,有好多都没说到点子上,有些靠谱的是说“清空/tmp目录就好了”,但对我并不适合。所以,需要设定生成临时文件的目录位置。


又查了一圈,指向这里:

https://hadoop.apache.org/docs/r1.2.1/streaming.html#Specifying+Configuration+Variables+with+the+-D+Option

===============================================================

Exception in thread "main" java.io.IOException: No space left on device

Specifying Directories

To change the local temp directory use:

-D dfs.data.dir=/tmp

To specify additional local temp directories use:

-D mapred.local.dir=/tmp/local-D mapred.system.dir=/tmp/system-D mapred.temp.dir=/tmp/temp Exception in thread "main" java.io.IOException: No space left on device
===============================================================

结果试了还是不行,没有一个起作用。我还猜测是不是和jar包中的设置冲突了,结果看到“Frequently Asked Questions”部分,发现已经有答案了。。。

如下:

Exception in thread "main" java.io.IOException: No space left on device
What do I do if I get the "No space left on device" error? 

For example, when I run a streaming job by distributing large executables (for example, 3.6G) through the -file option, I get a "No space left on device" error.  The jar packaging happens in a directory pointed to by the configuration variable stream.tmpdir. 

The default value of stream.tmpdir is /tmp. Set the value to a directory with more space: 

 -D stream.tmpdir=/export/bigspace/...






Exception in thread "main" java.io.IOException: No space left on device

总结

以上是生活随笔为你收集整理的Hadoop streaming: Exception in thread main java.io.IOException: No space left on device的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。