Use the following steps to prepare your system for the upgrade.
Use the Services View on the Ambari Web UI to stop all services, including MapReduce and all clients, running on HDFS. Do not stop HDFS yet.
Run
fsck
with the following flags and send the results to a log. The resulting file contains a complete block map of the file system. You use this log later to confirm the upgrade.su $HDFS_USER hadoop fsck / -files -blocks -locations > /tmp/dfs-old-fsck-1.log
where
$HDFS_USER
is the HDFS Service user (by default,hdfs
).Prepare other logs for comparing your system's state before and after the upgrade.
Note You must be the HDFS service user (by default,
hdfs
) when you run these commands.Capture the complete namespace of the filesystem. (The following command does a recursive listing of the root file system.)
su $HDFS_USER hadoop dfs -lsr / > /tmp/dfs-old-lsr-1.log
where
$HDFS_USER
is the HDFS Service user (by default,hdfs
).Create a list of all the DataNodes in the cluster.
su $HDFS_USER hadoop dfsadmin -report > /tmp/dfs-old-report-1.log
where
$HDFS_USER
is the HDFS Service user (by default,hdfs
).Optional: copy all or unrecoverable only data stored in HDFS to a local file system or to a backup instance of HDFS.
Optional: create the logs again and check to make sure the results are identical.
Save the namespace. You must be the HDFS service user to do this and you will need to put the cluster in Safe Mode.
hadoop dfsadmin -safemode enter hadoop dfsadmin -saveNamespace
Copy the following checkpoint files into a backup directory. You can find the directory by using the Services View in the UI. Select the HDFS service, the Configs tab, in the Namenode section, look up the property NameNode Directories. It will be on your NameNode host.
dfs.name.dir/edits
dfs.name.dir/image/fsimage
Stop HDFS. Make sure all services in the cluster are completely stopped.
If you are upgrading Hive, back up the Hive database.
Move the
conf.save
directory for Ambari server and agents to a back up location:mv /etc/ambari-server/conf.save/ /etc/ambari-server/conf.save.bak
mv /etc/ambari-agent/conf.save/ /etc/ambari-agent/conf.save.bak