Friday, October 14, 2011

Could only be replicated to 0 nodes, instead of 1 Hadoop 0.20.2

could only be replicated to 0 nodes, instead of 1 is a common problem we encounter in hadoop time and often.

I faced this problem in my single node hadoop cluster. When I surfed in the internet for possible answer, I was taken to hadoop's website HowToSetupYourDevelopmentEnvironment. The hadoop wiki was making suggestions to erase all HDFS data and reformat it. The suggestion was far from being pragmatic that we have to reformat our cluster for any potential problem in HDFS. Imagine we have a production cluster and we have to reformat it.


Steps to Fix :

Issue df command to view the space available in each Linux mount we have and more specifically the mount hadoop is in.

[root@bishal hadoop-0.20.2]# df -kh


Filesystem Size Used Avail Use% Mounted on
/dev/hdg3 143G 135G 0M 100% /
/dev/hdg1 99M 11M 83M 12% /boot
none 2.0G 0 2.0G 0% /dev/shm



Upon issuing this comand I found that my filesystem had no disk space available. The inability of hadoop write in HDFS was due to insufficient disk space. Freed some disk space and the problem was solved.


Issue Linux command to empty Recycle bin

[root@bishal hadoop-0.20.2]# rm -rf ~/.Trash/*rm

Now recheck the disk space. Delete some unnecessary files in your FileSystem if upon emptying Recycle bin not enough space is freed. Enough disk space should be freed to let hadoop write files in HDFS. If the block size for hadoop is 128MB, make sure we have fread at least 128MB of disk space.


Now run your MapReduce job. The problem with should be fixed.

No comments: