In an HA cluster, two separate machines are configured to become a namenode. At any moment, only one namenode is active and the other is standby state. The active Namenode is responsible for all request operations from the client, while standby is ready to become active namenode on standby.
To maintain synchronization between Namenode active and Namenode standby, two namenode are synchronized through a daemon called journalnodes. When Namenode active namespace has been modified, Namenode active logs the operations log on Journalnodes. The Namenode standby will then read these operations logs from the edits on Journalnodes. When Namenode gets the edits operation log, it applies the log operation to its own namespace. Once the Namenode active problem occurs, Namenode standby can ensure that he has read all the edits operations logs before becoming Namenode active.
In order to provide a fast hot standby switch, it is necessary to namenode standby time to know the location of the block information, to achieve this, datanode node configuration namenode information, Datanode then actively sends the location information and heartbeat data of the block to two Namenode.
Ensuring that only one active Namenode is critical at any time, otherwise, can result in data loss and some serious consequences. Journalnodes will guarantee that there is only one namenode active at the same time. At the time of hot standby switching, Namenode standby, which is about to become active, takes over the role of writer.
Translation of the official website QJN Architecture: