Dear Learner,
Hope you are doing well.
Please accept our sincerely apology for delay in response.
To identify whether a node is active or standby, you can use below command
hdfs haadmin -getServiceState
Also below commands can be used
To print out the namenodes use this command: hdfs getconf -namenodes
To print out the secondary namenodes: hdfs getconf -secondaryNameNodes
To print out the backup namenodes: hdfs getconf -backupNodes
Failover
automatic failover is configured in 2.x
Automatic failover adds two new components to an HDFS deployment: a ZooKeeper quorum, and the ZKFailoverController process (abbreviated as ZKFC).
Failure detection - each of the NameNode machines in the cluster maintains a persistent session in ZooKeeper. If the machine crashes, the ZooKeeper session will expire, notifying the other NameNode that a failover should be triggered.
Active NameNode election - ZooKeeper provides a simple mechanism to exclusively elect a node as active. If the current active NameNode crashes, another node may take a special exclusive lock in ZooKeeper indicating that it should become the next active.
Hope it resolves your query.
If you have any further issue,please let us know.