0
votes

I am trying to setup single node hadoop setup in Ubuntu ,when i ran hadoop namenode -format I got the an error "Cannot delete directory /app/hadoop/tmp/dfs/name/current". I deleted current directory as root user and then tried command then got different error as follow:

hduser@ubuntu:/usr/local/hadoop/bin$ hadoop namenode -format
14/06/17 22:58:46 INFO namenode.NameNode: STARTUP_MSG: 
/************************************************************
STARTUP_MSG: Starting NameNode
STARTUP_MSG:   host = ubuntu/127.0.1.1
STARTUP_MSG:   args = [-format]
STARTUP_MSG:   version = 1.2.1
STARTUP_MSG:   build = https://svn.apache.org/repos/asf/hadoop/common/branches/branch-1.2 -r 1503152; compiled by 'mattf' on Mon Jul 22 15:23:09 PDT 2013
STARTUP_MSG:   java = 1.7.0_55
**************************************************
Re-format filesystem in /app/hadoop/tmp/dfs/name ? (Y or N) Y
14/06/17 22:58:49 INFO util.GSet: Computing capacity for map BlocksMap
14/06/17 22:58:49 INFO util.GSet: VM type       = 64-bit
14/06/17 22:58:49 INFO util.GSet: 2.0% max memory = 1013645312
14/06/17 22:58:49 INFO util.GSet: capacity      = 2^21 = 2097152 entries
14/06/17 22:58:49 INFO util.GSet: recommended=2097152, actual=2097152
14/06/17 22:58:51 INFO namenode.FSNamesystem: fsOwner=hduser
14/06/17 22:58:51 INFO namenode.FSNamesystem: supergroup=supergroup
14/06/17 22:58:51 INFO namenode.FSNamesystem: isPermissionEnabled=true
14/06/17 22:58:51 INFO namenode.FSNamesystem: dfs.block.invalidate.limit=100
14/06/17 22:58:51 INFO namenode.FSNamesystem: isAccessTokenEnabled=false accessKeyUpdateInterval=0 min(s), accessTokenLifetime=0 min(s)
14/06/17 22:58:51 INFO namenode.FSEditLog: dfs.namenode.edits.toleration.length = 0
14/06/17 22:58:51 INFO namenode.NameNode: Caching file names occuring more than 10 times 
14/06/17 22:58:52 ERROR namenode.NameNode: java.io.IOException: Cannot create directory /app/hadoop/tmp/dfs/name/current
    at org.apache.hadoop.hdfs.server.common.Storage$StorageDirectory.clearDirectory(Storage.java:294)
    at org.apache.hadoop.hdfs.server.namenode.FSImage.format(FSImage.java:1337)
    at org.apache.hadoop.hdfs.server.namenode.FSImage.format(FSImage.java:1356)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.format(NameNode.java:1261)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.createNameNode(NameNode.java:1467)
    at org.apache.hadoop.hdfs.server.namenode.NameNode.main(NameNode.java:1488)

14/06/17 22:58:52 INFO namenode.NameNode: SHUTDOWN_MSG: 
/************************************************************
SHUTDOWN_MSG: Shutting down NameNode at ubuntu/127.0.1.1

Then i tried with sudo command and I tried giving access to hduser as well but that didn't work.

hduser@ubuntu:/usr/local/hadoop/bin$ sudo hadoop namenode -format
[sudo] password for hduser: 
sudo: hadoop: command not found

I tried searching for solutions and made changes in conf/hdfs-site.xml as well but didn't work. How to fix this?

1
Try sudo -u hdfs hadoop namenode -formatvisakh
hduser@ubuntu:/usr/local/hadoop/bin$ sudo -u hduser hadoop namenode -format sudo: hadoop: command not foundashwini
You could try changing the owner of the directory to hduser using chown command and retry itvisakh
another option is to run with the full path - sudo /usr/local/hadoop/bin/hadoop namenode -formatvisakh

1 Answers

0
votes

Try to create the directory manually from shell as hduser user: hduser@ubuntu: mkdir /app/hadoop/tmp/dfs/name/current and post the error. If you get "Permission denied", post the rights of directory name, dfs and tmp.