hadoophdfsnamenode

How can I solve this problem : hadoop namenode -format gives error?


I setup Hadoop HA Cluster.

I try to format hadoop as below code:

hdfs --loglevel DEBUG namenode -format -force

then when I see the log ( it is not DEBUG mode and this is another problem which i ve not solved) it gives error as below:

error org.apacge.hadoop.hdfs.server.namenode.NameNode: Failed to start namenode.
java.io.FileNotFoundException : ..../current/VERSION (Permission denied)

When I check the current folder after format , its recreated but with root ownership. And the folder just has seen_txid and VERSION files.

If I change the ownership (chown -R hdfs:hadoop ...../current) , it gives error now as below:

 error org.apacge.hadoop.hdfs.server.namenode.NameNode: Failed to start namenode.
 java.io.FileNotFoundException : no valid image files found 

because under current folder there is no image file. And i cant see any other logs ( i cant set log level to debug)


Solution

  • I solved this issue ;

    1. stop all hdfs services
    2. start journal services
    3. namenode service (just one)
    4. format namenode
    5. in /var/log/hadoop.log there is warning like (journal cant be formatted because of file exists)
    6. delete files which reported in the logs
    7. format again and it works
    8. start other namenodes and hdfs services (zkfc ,datanode .. )