Created 04-19-2018 01:50 PM
i want to take abckup of fsimage maintaining everything so when something happens then with the use of backup I namenode could be up .
Created 04-19-2018 02:34 PM
#Put the namenode into safemode
hdfs dfsadmin -safemode enter
#save all the trsactions to namespace
hdfs dfsadmin -saveNamespace
#Download the FSImage of namenode
hdfs dfsadmin -fetchImage <path-forimage>
#Bring the namenode out from safemode
hdfs dfsadmin -safemode leave
#This step is critical
# Navigate to metadata directory
cd /data/dfs/nn
#Extract to the location wherever you want.
tar -cvf /root/nn_backup_data.tar .
Created 04-19-2018 02:39 PM
Here is the other way
Backing Up and Restoring HDFS Metadata
Backing Up HDFS Metadata Using Cloudera Manager
HDFS metadata backups can be used to restore a NameNode when both NameNode roles have failed. In addition, Cloudera recommends backing up HDFS metadata before a major upgrade.
Minimum Required Role: (also provided by Full Administrator)
This backup method requires you to shut down the cluster.
# tar -cvf /root/nn_backup_data.tar .
You should see output like this:
./
./current/
./current/fsimage
./current/fstime
./current/VERSION
./current/edits
./image/
./image/fsimage
If there is a file with the extension lock in the NameNode data directory, the NameNode most likely is still running. Repeat the steps, starting by shutting down the NameNode role.
Restoring HDFS Metadata From a Backup
The following process assumes a scenario where both NameNode hosts have failed and you must restore from a backup.