解决hadoop的启动异常

启动hadoop出现异常,查看namenode日志:

java.io.IOException: File /tmp/hadoop-root/mapred/system/jobtracker.info could only be replicated to 0 nodes, instead of 1

网上查找原因,有这样的解决办法:

引用
问题:I am trying to resolve an IOException error. I have a basic setup and shortly after running start-dfs.sh I get a: error: java.io.IOException: File /tmp/hadoop-root/mapred/system/jobtracker.info could only be replicated to 0 nodes, instead of 1 java.io.IOException: File /tmp/hadoop-root/mapred/system/jobtracker.info could only be replicated to 0 nodes, instead of 1 Any pointers how to resolve this? Thanks!

解答:You'll probably find that even though the name node starts, it doesn't have any data nodes and is completely empty. Whenever hadoop creates a new filesystem, it assigns a large random number to it to prevent you from mixing datanodes from different filesystems on accident. When you reformat the name node its FS has one ID, but your data nodes still have chunks of the old FS with a different ID and so will refuse to connect to the namenode. You need to make sure these are cleaned up before reformatting. You can do it just by deleting the data node directory, although there's probably a more "official" way to do it.


这个原因是执行如下命令导致的:

$hadoop namenode -format

解决办法是删除掉data.dir目录,我查了一下,删除的是如下这个目录:

/tmp/hadoop-root/dfs/data

然后 reformat namenode,问题解决。

你可能感兴趣的:(hadoop,NameNode)