HDFS metadata and DataNode blocks must remain consistent when cluster software changes. An offline Apache Hadoop upgrade on a single-NameNode Linux cluster replaces the binaries across the hosts while preserving existing data and restoring YARN applications.
Versioned installation directories and an external configuration directory let the new release reuse storage paths, service accounts, and security settings. Moving from Hadoop 3.4.3 to 3.5.0 also requires Java 17 on every server, so the Java runtime must change with the Hadoop binaries.
The maintenance window interrupts HDFS access and YARN jobs. HDFS retains its pre-upgrade state until finalization, but rollback discards changes made after the upgrade; finalization removes that rollback option entirely.
The starting installation uses /opt/hadoop as a symlink to /opt/hadoop-3.4.3, with HADOOP_CONF_DIR=/etc/hadoop already set for both service accounts. HDFS commands run as the existing hdfs owner, YARN start/stop scripts as yarn, and sudo commands as an administrator. The start/stop scripts already have SSH access to the configured workers. Java 17, the target archive, and its Apache checksum file must be available on every host. The SHA-512 digest from sha512sum hadoop-3.5.0-aarch64.tar.gz must match Apache's downloaded checksum before extraction. The ARM64 checksum file names hadoop-3.5.0.tar.gz even though the archive includes -aarch64; x86-64 hosts need the matching binary and checksum. The archive commands assume the download directory is current. A recoverable off-host data backup and an approved maintenance window are prerequisites. HA clusters need an HA-specific upgrade plan.
Related: How to configure HDFS high availability with QJM
Steps to upgrade Apache Hadoop:
- Confirm the installed Hadoop release before choosing the upgrade path.
$ hadoop version Hadoop 3.4.3 ##### snipped #####
The target here is 3.5.0. Apache's release notes describe its Java requirement and incompatible changes. A vendor-managed installation needs its vendor's upgrade procedure.
- Check HDFS for missing or corrupt blocks before stopping the cluster.
$ hdfs fsck / ##### snipped ##### Status: HEALTHY ##### snipped ##### The filesystem under path '/' is HEALTHY
A healthy result also needs the expected DataNodes and replication level; under-replicated blocks require investigation before maintenance. An unfinished earlier upgrade must be resolved before another upgrade begins.
Related: How to check HDFS cluster health - Stop YARN from the ResourceManager host after submitted jobs have finished.
This stops scheduling and worker execution. Applications still running when the daemons stop can fail.
$ stop-yarn.sh Stopping nodemanagers Stopping resourcemanager
- Put HDFS into safe mode as the HDFS administrator.
$ hdfs dfsadmin -safemode enter Safe mode is ON
- Save the NameNode namespace while HDFS remains in safe mode.
$ hdfs dfsadmin -saveNamespace Save namespace successful
- Stop HDFS from the NameNode host.
$ stop-dfs.sh Stopping namenodes on [master01.example.net] Stopping datanodes Stopping secondary namenodes [master01.example.net]
All NameNode, DataNode, and checkpoint daemons must be stopped before the binary switch.
Related: How to restart Hadoop services - Archive the stopped NameNode's metadata and Hadoop configuration outside its storage directory.
$ sudo tar -czf /var/backups/hadoop/pre-3.5.0.tgz \ -C /etc hadoop -C /data/hadoop/hdfs nameThe backup directory must already exist. This installation stores NameNode metadata in /data/hadoop/hdfs/name; additional configured name or edits directories need their own copies. This archive contains no DataNode blocks and does not replace the off-host data backup.
Related: How to create a Hadoop NameNode checkpoint - Extract the checked target release beside the old installation on every host.
$ sudo tar -xzf hadoop-3.5.0-aarch64.tar.gz -C /opt
The previous release and all HDFS storage directories stay in place. No NameNode format is part of an upgrade.
- Replace the active JAVA_HOME assignment in /etc/hadoop/hadoop-env.sh on every host with the installed Java 17 directory.
$ sudoedit /etc/hadoop/hadoop-env.sh
- /etc/hadoop/hadoop-env.sh
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-arm64
This is the Ubuntu ARM64 JDK path. The assignment needs the local Java 17 path on other systems; other settings and security configuration remain intact.
- Switch the Hadoop symlink to the new installation on every host.
$ sudo ln -sfn /opt/hadoop-3.5.0 /opt/hadoop
All hosts must point to the new release before any daemon starts. The external configuration still identifies the original NameNode and DataNode storage.
- Start HDFS in upgrade mode from the NameNode host.
$ start-dfs.sh -upgrade Starting namenodes on [master01.example.net] Starting datanodes Starting secondary namenodes [master01.example.net]
- Wait for HDFS to leave startup safe mode.
$ hdfs dfsadmin -safemode wait Safe mode is OFF
A wait that does not finish calls for checking NameNode and DataNode logs; forcing safe mode off can conceal missing blocks.
- Check HDFS health after the upgraded daemons start.
$ hdfs fsck / ##### snipped ##### Status: HEALTHY ##### snipped ##### The filesystem under path '/' is HEALTHY
- Confirm the active Hadoop release after the upgrade.
$ hadoop version Hadoop 3.5.0 ##### snipped #####
- Start YARN from the ResourceManager host.
$ start-yarn.sh Starting resourcemanager Starting nodemanagers
- Run the new release's word-count application against the existing HDFS input.
$ yarn jar /opt/hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-3.5.0.jar \ wordcount /datasets/upgrade-check/input.txt /tmp/upgrade-check-350 ##### snipped ##### 2026-11-08 11:39:00,509 INFO mapreduce.Job: map 100% reduce 100% 2026-11-08 11:39:01,527 INFO mapreduce.Job: Job job_1794137919369_0001 completed successfully ##### snipped #####The input path represents an existing text file; the displayed counts come from text containing hadoop hdfs hadoop and yarn hdfs. The output directory must not already exist. A job that fails or remains queued needs investigation before finalization. Normal application smoke tests also belong before the rollback decision.
- Finalize the HDFS upgrade only after the new release has passed the required observation period.
This permanently removes HDFS's previous storage state. Before finalization, a failed upgrade can follow Apache's offline rollback procedure with the retained old binaries, configuration, and Java runtime; that restores the pre-upgrade HDFS state and loses later changes. Finalization is the point at which that option is surrendered.
$ hdfs dfsadmin -finalizeUpgrade Finalize upgrade successful
- Read the YARN job's HDFS output after finalization.
$ hdfs dfs -cat /tmp/upgrade-check-350/part-r-00000 hadoop 2 hdfs 2 yarn 1
Readable output confirms that the upgraded cluster ran a MapReduce job and retained its result after finalization.