ZooKeeper-Failover-Controller or in short ZKFC is the new component which also acts as a client for ZooKeeper is the one which monitors and manages the state of the Namenode. Each of the machines which run Namenode also runs the ZKFC.
The ZKFC is responsible for:
1. Health Monitoring: Similar to heart-beat, ZKFC also sends a signal to Namenode. If the Namenode responds, then it is stable. if it is unable to respond due to any issues like frozen or struck, then ZKFC considers the Namenode to be dead.
2. ZooKeeper session management: If the local node is healthy, then the zookeeper holds the "lock" Znode. this lock uses ZooKeeper's support for "ephemeral" nodes. This lock node gets expired or killed when the session is expired.
3. ZooKeeper-based election: In case if the local name node is healthy and ZKFC observes no other node is holding the lock znode, then it automatically acquire the lock. If it succeeds, then it means it won the elections and if not then it is responsible for running failover to make its local name node active.