This post describes how to do an Express Upgrade of Hortonworks Data Platform (HDP) with Ambari.
Ugrading HDP begins with upgrading Ambari, Ambari Metrics and, not mandatory but recommended, adding Grafana.
When this is in place and all services are up and running, Upgrading HDP to 2.4 can begin.
Backup
File backup
Creating a backup of all the important files and databases is the first step. The following steps are done on the NameNode.
Create backup directory
mkdir /home/ubuntu/HDP-2.3.4-backup
Run HDFS filesystem check and save the ouptut to a file in the backup directory
sudo -u hdfs hdfs fsck / -files -blocks -locations > /home/ubuntu/HDP-2.3.4-backup/dfs-old-fsck-1.log
Gather basic filesystem information and statistics in a report
sudo -u hdfs hdfs dfsadmin -report > /home/ubuntu/HDP-2.3.4-backup/dfs-old-report-1.log
List the whole HDFS directory and save the ouptut to a file
sudo -u hdfs hdfs dfs -ls -R > /home/ubuntu/HDP-2.3.4-backup/dfs-old-lsr-1.log
Enter Safemode, mandatory for next steps
sudo -u hdfs hdfs dfsadmin -safemode enter
Save current namespace and reset edits log
sudo -u hdfs hdfs dfsadmin -saveNamespace
Make a copy of the VERSION file (here is HDP’s default directoy, file VERSION should reside in ${dfs.namenode.name.dir}/current)
sudo cp /hadoop/hdfs/namenode/current/VERSION /home/ubuntu/HDP-2.3.4-backup/
Leave Safemode
sudo -u hdfs hdfs dfsadmin -safemode leave
Finalize upgrade of HDFS
According to the Apache Hadoop documentation:
“Datanodes delete their previous version working directories, followed by Namenode doing the same. This completes the upgrade process.”
sudo -u hdfs hdfs dfsadmin -finalizeUpgrade
Database backup
My cluster has MySql database that is used by Hive and Ranger. That means I have 3 databases to back up: hive, ranger and ranger_audit (since I am storing audit data in a database).
hive
DAT=`date +%Y%m%d_%H%M%S` mysqldump -u root -proot hive > /home/ubuntu/HDP-2.3.4-backup/hive_$DAT.sql
This is done beforehand so that you can check the checkbox and move on in the process of upgrade
Ranger
This is done beforehand so that you can check the checkbox and move on in the process of upgrade
ranger_admin
DAT=`date +%Y%m%d_%H%M%S` mysqldump -u root -proot ranger > /home/ubuntu/HDP-2.3.4-backup/ranger_$DAT.sql
ranger_audit
DAT=`date +%Y%m%d_%H%M%S` mysqldump -u root -proot ranger_audit > /home/ubuntu/HDP-2.3.4-backup/ranger_audit_$DAT.sql
Content of backup folder
/home/ubuntu/HDP-2.3.4-backup/
├── dfs-old-fsck-1.log
├── dfs-old-lsr-1.log
├── dfs-old-report-1.log
├── hive_20160804_074811.sql
├── ranger_20160804_074907.sql
├── ranger_audit_20160804_074914.sql
└── VERSION
Click below on Page 2 to continue with the process.