Ambari Upgrade Guide
Also available as:

Prepare to Upgrade

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

  1. 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.

  2. 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 in the NameNode Directories property. Make sure that only a "/current" directory and no "/previous" directory exists on the NameNode host.

  3. 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:

      hdfs 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.

  4. 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


    In a highly-available NameNode configuration, the command hdfs dfsadmin -saveNamespace sets 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

  5. Copy the checkpoint files located in ${}/current into a backup directory.


    In a highly-available NameNode configuration, the location of the checkpoint depends on where the saveNamespace command is sent, as defined in the preceding step.

  6. Store the layoutVersion for the NameNode located at

    ${}/current/VERSION, into a backup directory where

    ${} is the value of the config parameter NameNode directories.

    This file will be used later to verify that the layout version is upgraded.

  7. As the HDFS user, "su -l <HDFS_USER>", take the NameNode out of Safe Mode.

    hdfs dfsadmin -safemode leave

  8. 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 Register and Install Target Version.