Differences between RabbitMQ and Kafka
March 8, 2021Definitive guide on Spark join algorithms
March 12, 2021Don’t run the command until you fully understand what you are trying to do.
hadoop namenode -format
will format or delete all files and folders in the Namenode directory.
Namenode & HDFS metadata
Namenode is responsible for maintaining the metadata of HDFS. This includes information about the files, directories, block locations, permissions etc.
The above information is maintained under directory specified by dfs.namenode.name.dir
<property> <name>dfs.namenode.name.dir</name> <value>file:///data/dfs/namenode</value> </property>
hadoop namenode -format will wipe out the directory clean. This means you don’t have a way to know what was in the HDFS because you have now essentially deleted all the metadata managed by NameNdoe even though the data that is managed by the DataNode will not be deleted.
You usually don’t perform this operation on a cluster that is in operation. It is usually performed on a failed installation where you have decided to start from scratch.