Reply
Highlighted
tuk
Explorer
Posts: 10
Registered: ‎12-05-2017

Role of 'prepare' command & 'safemode' in HDFS Rolling Upgrade

[ Edited ]

In HDFS rolling upgrade page at a high level I am seeing the steps mentioned like below

 

  1. hdfs dfsadmin -rollingUpgrade prepare
  2. Upgrade standby NN2 and start NN2 with hdfs dfsadmin -rollingUpgrade started
  3. Shutdown, upgrade NN1 and start NN1 with hdfs dfsadmin -rollingUpgrade started

But in cloudera documentation of Hadoop to prepare the cluster for upgrade it is just saying to enter NN in safemode & save namespace

sudo -u hdfs hdfs dfsadmin -safemode enter
sudo -u hdfs hdfs dfsadmin -saveNamespace 
  1. Can some one let me know why there is a difference in the above steps?
  2. Is it just sufficient to enter in -safemode before doing the upgrade?
  3. If yes what does -rollingUpgrade started do then?
  4. In the cloudera documentation I am not seeing anything about -safemode leave. When it will leave the safemode? Will it auto leave the safemode ?
Contributor
Posts: 32
Registered: ‎02-15-2016

Re: Role of 'prepare' command & 'safemode' in HDFS Rolling Upgrade

The first step in Cloudera documentation (-safemode enter) is for NN to enter "read-only" mode, where it stops accepting new changes to the filesystem or blocks. This is done to make sure you get a consistent copy of the in-memory fsimage file. The next step (-savenamespace) is basically writing that consistent copy of in-memory fsimage to the fsimage on disk, so that just in case anything wrong during the upgrade, your data is not lost.

 

The first command on the HDFS rolling upgrade page (-rollingUpgrade prepare) does the same thing in the background. 

 

When you shutdown or restart HDFS, NN comes out of safemode automatically.

Announcements