Support Questions
Find answers, ask questions, and share your expertise

NameNode Metadata backup

Explorer

Can someone give me an correct approach on how to take the namenode metadata backup.

1. Taking snapshots of NN directory is enough

2.If I use this "hdfs dfsadmin -fetchImage someFilename " then how do I backup the editlogs.

3. I found this URL for HDFS backup

https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.3.0-Win/bk_HDP_Upgrade_Win/content/ref-fe148733...

Please suggest me how to take the backup NameNode metadata.

Thanks in advance

7 REPLIES 7

Re: NameNode Metadata backup

Re: NameNode Metadata backup

Explorer

I followed the give link and took backup like this. Please correct me if I miss anything

su hdfs

hdfs dfsadmin -rollEdits

hdfs dfsadmin -fetchImage data/hadoop/hdfs/namenode/current/fsimg_bkp

took copy of VERSION file

Re: NameNode Metadata backup

Explorer

@Sagar Shimpi

Could you please direct me how to test it. Please suggest me if this correct approach

./bin/hadoop namenode -recover

./bin/hdfs namenode -initializeSharedEdits

./bin/hadoop fsck -delete /

Re: NameNode Metadata backup

Expert Contributor

Follow as below

1) back-up the block location

sudo -u hdfs hdfs fsck / -files -blocks -locations > /data/backup2082016/dfs-old-fsck-1.log Connecting to namenode via http://hostname.name.com:50070/fsck?ugi=hdfs&files=1&blocks=1&locations=1&path=%2F

2)Put namenode in safemode

root@hostname[backup2082016] # sudo -u hdfs hdfs dfsadmin -fs hdfs://host.name.com:8020 -saveNamespace saveNamespace: Safe mode should be turned ON in order to create namespace image.

root@hostname[backup2082016] # sudo -u hdfs hdfs dfsadmin -safemode enter

Safe mode is ON in

root@hostname[backup2082016] # sudo -u hdfs hdfs dfsadmin -fs hdfs://host.name.com:8020 -saveNamespace Save namespace successful

3) Go Namenode storage directory and take the back of that file

NameNode directories= /data/hadoop/hdfs/namenode/

Re: NameNode Metadata backup

Expert Contributor

In Namenode Storage directory, take the back of current directory.

drwxr-xr-x 2 hdfs hadoop 36864 Nov 23 14:27 current

and Put nanenode back to normal mode.

root@hostname[backup2082016] # sudo -u hdfs hdfs dfsadmin -safemode leave

Re: NameNode Metadata backup

Explorer

@zkfs


Thanks for the detailed backup process, I am able to backup as mentioned.

I wanted to know ho we restore the content which you are taking backup /data/backup2082016/dfs-old-fsck-1.log.

at the end this log file should be useful somewhere how are we making use of this log file?I can recover the current directory by creating same folder structure and place it there back but how about the dfs-old-fsck-1.log?


Please let me know.


Regards,

Manjunath P N

Re: NameNode Metadata backup

how to take hdfs namenode back up on plain venilla apache environment can any one send those steps please