Time for action – adding an additional fsimage location
Let's now configure our NameNode to simultaneously write multiple copies of fsimage
to give us our desired data resilience. To do this, we require an NFS-exported directory.
Ensure the cluster is stopped.
$ stopall.sh
Add the following property to
Hadoop/conf/core-site.xml
, modifying the second path to point to an NFS-mounted location to which the additional copy of NameNode data can be written.<property> <name>dfs.name.dir</name> <value>${hadoop.tmp.dir}/dfs/name,/share/backup/namenode</value> </property>
Delete any existing contents of the newly added directory.
$ rm -f /share/backup/namenode
Start the cluster.
$ start-all.sh
Verify that
fsimage
is being written to both the specified locations by running themd5sum
command against the two files specified before (change the following code depending on your configured locations):$ md5sum /var/hadoop/dfs/name/image/fsimage a25432981b0ecd6b70da647e9b94304a...