registered

inHDFS – The four roles of HDFSThe Server has many protocols, one of which is called the DataNode protocol. It responds to the requests of the DataNode, such as registration, heartbeat, block packet processing, etc.



When the DataNode is started, it will send its IP address, port, host name and other information to the NameNode for registration. In order to make the registration successful, the DataNode will try again until it succeeds.



The NameNode receives the request, he will verify whether they have start to finish, if you have successfully sent the information of the DataNode to join memory DatanodeManager. DatanodeMap complete registration, and add to HeartbeatManager. The datanodes, The HeartbeatManager is used to manage heartbeats. And when that’s done, it decides if it’s in safe mode,Safe modeWe talked about that in the last chapter.

The heartbeat

After successful registration, the DataNode will send a heartbeat to the NameNode every three seconds.

When the NameNode receives the heartbeat request, it also determines whether it has started.

Due to the registration, the DataNode information stored in the DatanodeManager. DatanodeMap, so send a heartbeat, will verify in the memory, if not, that is not registered.

If registered, the last heartbeat time is updated with the HeartbeatManager.

In Hadoop, NameNode does not send instructions to the DataNode. After sending the heartbeat through the DataNode, NameNode returns instructions to the DataNode.

To eliminate

When the NameNode finds that a DataNode has not sent heartbeat information for a long time, it will be removed from the database. HeartbeatManager in one thread, the default will check once every 5 minutes, this time by DFS. The namenode. Heartbeat. Recheck – interval setting. When the HeartbeatManager checks, it will traverse all datanodes and determine if each DataNode is dead. If it is, the HeartbeatManager will remove it from memory. And when you get rid of it, you decide if you’re in safe mode. = ‘heartbeatcheckInterval’ = ‘heartbeatIntervalSeconds’ =’ heartbeatIntervalSeconds’ = ‘heartbeatIntervalSeconds’ =’ heartbeatIntervalSeconds’ = ‘heartbeatIntervalSeconds’ =’ heartbeatIntervalSeconds’ = ‘heartbeatIntervalSeconds’ =’ heartbeatIntervalSeconds’ = ‘heartbeatIntervalSeconds’ =’ heartbeatIntervalSeconds’ = ‘heartbeatIntervalSeconds’ If the DataNode does not send a heartbeat after 630 seconds, the NameNode will assume that the DataNode is dead and will be removed from memory.

2
heartbeatRecheckInterval + 10 1000 * heartbeatIntervalSeconds