Review Preparing to Upgrade Ambari and HDP. It is also strongly recommended that you perform backups of your databases before beginning upgrade.
- Ambari database 
- Hive Metastore database 
- Oozie Server database 
- Ranger Admin database 
- Ranger Audit database 
Checkpoint HDFS
- Perform the following steps on the NameNode host. If you are configured for NameNode HA, perform the following steps on the Active NameNode. You can locate the Active NameNode from - Ambari Web > Services > HDFS in the Summary area.
- Check the NameNode directory to ensure that there is no snapshot of any prior HDFS upgrade. Specifically, using Ambari Web, browse to - Services > HDFS > Configs,and examine the- dfs.namenode.name.dirin the- NameNode Directoriesproperty. Make sure that only a- "/current"directory and no- "/previous"directory exists on the NameNode host.
- Create the following log and other files. Creating these logs allows you to check the integrity of the file system after the Stack upgrade. As the HDFS user, - " su -l <HDFS_USER> "run the following (where <HDFS_USER> is the HDFS Service user, for example, hdfs):- 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. - hdfs fsck / -files -blocks -locations > dfs-old-fsck-1.log
- Create a list of all the DataNodes in the cluster. - hdfs dfsadmin -report > dfs-old-report-1.log
- Optional: Capture the complete namespace of the file system. The following command does a recursive listing of the root file system: - hadoop dfs -ls -R / > dfs-old-lsr-1.log
- Optional: Copy all unrecoverable data stored in HDFS to a local file system or to a backup instance of HDFS. 
 
- Save the namespace. As the HDFS user, " su -l <HDFS_USER> ", you must put the cluster in Safe Mode. - hdfs dfsadmin -safemode enter- hdfs dfsadmin -saveNamespace![[Note]](../common/images/admon/note.png) - Note - In a highly-available NameNode configuration, the command - hdfs dfsadmin -saveNamespacesets a checkpoint in the first NameNode specified in the configuration, in- dfs.ha.namenodes.[nameserviceID]. You can also use the- dfsadmin -fsoption to specify which NameNode to connect. For example, to force a checkpoint in NameNode2:- hdfs dfsadmin -fs hdfs://namenode2-hostname:namenode2-port -saveNamespace
- Copy the checkpoint files located in - ${dfs.namenode.name.dir}/currentinto a backup directory.![[Note]](../common/images/admon/note.png) - Note - In a highly-available NameNode configuration, the location of the checkpoint depends on where the - saveNamespacecommand is sent, as defined in the preceding step.
- Store the layoutVersion for the NameNode located at - ${dfs.namenode.name.dir}/current/VERSION, into a backup directory where- ${dfs.namenode.name.dir}is the value of the config parameter NameNode directories. This file will be used later to verify that the layout version is upgraded.
- As the HDFS user, "su -l <HDFS_USER>", take the NameNode out of Safe Mode. - hdfs dfsadmin -safemode leave
- Finalize any prior HDFS upgrade, if you have not done so already. As the HDFS user, " su -l <HDFS_USER> ", run the following: - hdfs dfsadmin -finalizeUpgrade
Proceed to Registering a New Version.


