What the command “hadoop namenode -format” will do

后端 未结 5 1874
眼角桃花
眼角桃花 2020-12-28 16:34

I am trying to learn Hadoop by following a tutorial and trying to do pseudo-distributed mode on my machine.

My core-site.xml is:



        
5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-28 17:31

    hadoop namenode -format this command deletes all files in your hdfs.

    tmp directory contains two folders datanode, namenode in local filesystem. if you format the namenode these two folders becomes empty.

    Note : if you want to format your namenode first stop all hadoop services then delete the tmp(contains namenode and datanode) folder in your local file system and start hadoop service surely it will take effect.

    Reason for Hadoop namenode -format :

    Hadoop NameNode is the centralized place of an HDFS file system which keeps the directory tree of all files in the file system, and tracks where across the cluster the file data is kept. In short, it keeps the metadata related to datanodes. When we format namenode it formats the meta-data related to data-nodes. By doing that, all the information on the datanodes are lost and they can be reused for new data.

    By default the namenode location will be at "/tmp/hadoop-myuser/dfs/name"

    While you formatting the namenode, this file location was cleared.

    To change the namenode location add the follwing properties At hdfs-site.xml

    
        dfs.namenode.name.dir
        file:/search/data/dfs/namenode
    
    
        dfs.datanode.data.dir
        file:/search/data/dfs/datanode
    
    

    I hope this will help you.. :-)

提交回复
热议问题