hadoop java.io.IOException: while running namenode

2019-02-05 00:48发布

I ran namenode -format.This is my output. I tried changing the file permissions chmod 777 hadoop.

I believe this line is the error ERROR namenode.NameNode: java.io.IOException: Cannot create directory /your/path/to/hadoop/tmp/dir/hadoop-hadoop/dfs/name/current

adoop@alexander-desktop:/usr/local/hadoop/bin$ ./hadoop namenode -format
12/07/03 17:03:56 INFO namenode.NameNode: STARTUP_MSG: 
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG:   host = alexander-desktop/127.0.1.1
STARTUP_MSG:   args = [-format]
STARTUP_MSG:   version = 0.20.2
STARTUP_MSG:   build = https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.20 -r 911707; compiled by 'chrisdo' on Fri Feb 19 08:07:34 UTC 2010
************************************************************/
12/07/03 17:03:56 INFO namenode.FSNamesystem: fsOwner=hadoop,hadoop
12/07/03 17:03:56 INFO namenode.FSNamesystem: supergroup=supergroup
12/07/03 17:03:56 INFO namenode.FSNamesystem: isPermissionEnabled=true
12/07/03 17:03:56 ERROR namenode.NameNode: java.io.IOException: Cannot create directory /your/path/to/hadoop/tmp/dir/hadoop-hadoop/dfs/name/current
    at org.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.clearDirectory(Storage.java:295)
    at org.apache.hadoop.hdfs.server.namenode.FSImage.format(FSImage.java:1086)
    at org.apache.hadoop.hdfs.server.namenode.FSImage.format(FSImage.java:1110)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:856)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:948)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:965)

12/07/03 17:03:56 INFO namenode.NameNode: SHUTDOWN_MSG: 
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at alexander-desktop/127.0.1.1


hadoop@alexander-desktop:/usr/local$ sudo hadoop/bin/hadoop namenode -format
sudo: /etc/sudoers is mode 0777, should be 0440
sudo: no valid sudoers sources found, quitting

5条回答
混吃等死
2楼-- · 2019-02-05 00:52

try with sudo (I realize you changed permissions) but I would still try sudo and check if that resolves the problem.

查看更多
仙女界的扛把子
3楼-- · 2019-02-05 00:55

This is a permissions issue. Either you can use 1. sudo 2. login as root

But the best solution is

sudo chown $HADOOP_HOME

hadoop namenode -format

Where HADOOP_HOME is your hadoop installation directory

查看更多
We Are One
4楼-- · 2019-02-05 01:06

sudo is broken in this situation, but pkexec (the command-line frontend to PolicyKit) still works, so you can fix it with a single command. No rebooting is necessary.

pkexec chmod 0440 /etc/sudoers

This assumes PolicyKit is installed. If this is a desktop system (rather than a server with no GUI), it is.

查看更多
劳资没心,怎么记你
5楼-- · 2019-02-05 01:09

Following steps resolved my problem -

1- sudo su

Enter your password.

2-/usr/local/hadoop/bin/hdfs namenode -format.

This has been done for hadoop2.5 in which "hadoop namenode -format" has beendeprecated hence using "hdfs namenode -format"

查看更多
神经病院院长
6楼-- · 2019-02-05 01:09

Check hdfs-site.xml configuration, it may has a wrong path for properties dfs.namenode.name.dir and dfs.datanode.data.dir In my case it was the cause of the problem (directory was situated in other then current user's home folder).

查看更多
登录 后发表回答