Make sure that you have saved the namespace. You should have done this here. The upgrade will fail if you do not save the namespace. If you have not saved the namespace yet:
Restart Ambari Server and Ambari Agents.
Restart HDFS only.
On the NameNode host:
su $HDFS_USER hadoop dfsadmin -safemode enter hadoop dfsadmin -saveNamespace
Stop the HDFS service and wait for it to be fully stopped.
Stop the Ambari Server and Ambari Agents.
Prepare for the upgrade:
Create an "Upgrade Folder", for example
/work/upgrade_hdp_2, on a host that can communicate with Ambari Server. The Ambari Server host would be a suitable candidate.Copy the upgrade script to the Upgrade Folder. The script is available here:
/var/lib/ambari-server/resources/scripts/UpgradeHelper_HDP2.pyon the Ambari Server host.Make sure that Python is available on the host and that the version is 2.6 or higher:
python --version
![[Note]](../common/images/admon/note.png)
Note For RHEL/Centos/Oracle Linux 5, you must use Python 2.6.
Start Ambari Server only. On the Ambari Server host:
ambari-server start
Back up current configuration settings and the component host mappings from MapReduce:
Go to the Upgrade Folder.
Execute the
backup-configsaction:python UpgradeHelper_HDP2.py --hostname $HOSTNAME --user $USERNAME --password $PASSWORD --clustername $CLUSTERNAME backup-configs
Where
$HOSTNAMEis the name of the Ambari Server host$USERNAMEis the admin user for Ambari Server$PASSWORDis the password for the admin user$CLUSTERNAMEis the name of the cluster
This step produces a set of files named TYPE_TAG, where TYPE is the configuration type and TAG is the tag. These files contain copies of the various configuration settings for the current (pre-upgrade) cluster. You can use these files as a reference later.
Execute the
save-mr-mappingaction:python UpgradeHelper_HDP2.py --hostname $HOSTNAME --user $USERNAME --password $PASSWORD --clustername $CLUSTERNAME save-mr-mapping
This step produces a file named
mr_mappingthat stores the host level mapping of MapReduce components such as MapReduce JobTracker/TaskTracker/Client.
Delete all the MapReduce server components installed on the cluster.
If you are not already there, go to the Upgrade Folder.
Execute the
delete-mraction.python UpgradeHelper_HDP2.py --hostname $HOSTNAME --user $USERNAME --password $PASSWORD --clustername $CLUSTERNAME delete-mr
If desired, you can use the -n option to see the API calls as they are being made so that you can verify them.
The script asks you to confirm that you have executed the
save-mr-mappingaction and that you have a file namedmr_mappingin the Upgrade Folder.

