Step 1 : Stop all the daemons, Add the user to sudo file for all the nodes.

Please make the following change as given below.

1) Login as root


2) Enter the given command to edit sudoers file:


3) Change the following as per screen-shot and to save the change press Esc >> Shift:wq


Step 2 : Format the namenode

hadoop namenode -format

Step 3 : Delete data directory mentioned in hdfs-site.xml

rm -rf directory_path

Step 4 : Again re-create the data directory and give chmod 755 permission to all the data directory

mkdir directory_path


chmod 755 directory_path



Please let me know if you have any further issue regarding this.