The high level approach is mentioned below.
a) The client will have a list of IP addresses of the Active and Standby, which it uses for the connection string.
b) For connecting to Namenode for the first time, the client will try to ping both the Namenodes. Whoever is reachable, client will treat him as the Active Namenode.
c) The information on which Namenode is Active is cached. For further client requests, DFSClient will route them to the Namenode whose URL is cached. This avoids the overhead of finding the Namenode always through trial and error.
d) When the client detects Active Namenode failure, it will start the switching procedure. Client keeps trying to ping both the Namenodes configured, until it can successfully connect to any one of them.