Hadoop每个文件块大小 [英] Hadoop per-file block size

查看:108
本文介绍了Hadoop每个文件块大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Hadoop书中,据说我们可以在创建文件时指定每个文件块的大小。

增加分割大小的最自然的方法是在HDFS中设置较大的块,通过设置dfs.block.size或在文件中以每个文件为基础施工时间。



任何想法如何在文件构建时做到这一点。我希望通过将其设置为value = file-size,文件不会被拆分。

解决方案

可以使用CLI:

  hadoop fs -D dfs.block.size =文件大小-put local_name remote_location 

或者您可以使用Java API在您要创建或复制文件时指定dfs.block.size。

  Configuration conf = new Configuration(); 
conf.setInt(dfs.block.size,file-size);


In Hadoop book it is said that we can specify per-file block size at the time of creation of file.

"The most natural way to increase the split size is to have larger blocks in HDFS, by setting dfs.block.size, or on a per-file basis at file construction time."

Any idea how to do this at file construction time. I hope by setting this to value = file-size, the file will not be split

解决方案

you can use CLI:

hadoop fs -D dfs.block.size=file-size -put local_name remote_location

or you can use Java API to specify the dfs.block.size when you want to create or copy files.

Configuration conf = new Configuration();
conf.setInt("dfs.block.size",file-size);

这篇关于Hadoop每个文件块大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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