修改HDFS块大小

环境:OS:Centos 6.5 x64 & Soft:Hadoop 1.2.1

1、查看当前块大小,默认64M。

[huser@master hadoop-1.2.1]$ bin/hadoop fs -stat "%o" ./in/test1.txt
67108864

2、修改hdfs-site.conf配置文件,增加全局参数dfs.block.size

[huser@master hadoop-1.2.1]$ cat conf/hdfs-site.xml 
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<!-- Put site-specific property overrides in this file. -->

<configuration>
 <property>
  <name>dfs.replication</name>
  <value>1</value>
 </property>
 <property>
  <name>dfs.block.size</name>
  <value>134217728</value>
 </property>
</configuration>

3、上传个新文件,查看文件块大小。

[huser@master hadoop-1.2.1]$ bin/hadoop fs -put ../input/tes4.txt ./in

[huser@master hadoop-1.2.1]$ bin/hadoop fs -stat "%o" ./in/test4.txt
134217728

原文地址:https://www.cnblogs.com/guarder/p/3704214.html