hdfs提示Target Replicas is 3 but found 2 replica(s) 问题解决


修改文件副本数为2(dfs.replication to 2 ) 后,仍提示一下问题:
Under-Replicated Blocks: Target Replicas is 3 but found 2 replica(s).
原因:设置dfs.replication并不会在已有应用中生效,该属性只对新建文件时副本属未指定时取作用,如果想改变副本采用,以下语句

hadoop fs -setrep [-R] [-w]
or
hdfs dfs -setrep [-R] [-w]
上传文件时,指定副本语句:
Hadoop dfs -D dfs.replication=1 -put test.txt logs/
修改所有文件副本数为2
hadoop dfs -setrep -w 2 -R /

你可能感兴趣的:(hadoop)