官术网_书友最值得收藏!

Configuring Datanode heartbeat

The Datanodes periodically update the Namenode about its presence or any changes in the blocks. The default Datanode heartbeat time is three seconds. But this does not mean that if a Datanode does not send a heartbeat for, say, 10 seconds, that the node will be marked dead.

In this recipe, we will look at how a heartbeat is configured and the parameters that play a role in its function.

Getting ready

You have a running cluster, and the user is familiar with Datanode communication with Namenode.

How to do it...

  1. ssh to Namenode and edit the hdfs-site.xml file to add the following property to it:
    <property>
    <name>dfs.heartbeat.interval</name>
    <value>3</value>
    </property>
    
    <property>
    <name>dfs.namenode.heartbeat.recheck-interval</name>
    <value>300000</value>
    </property>
  2. Copy hdfs-site.xml across all nodes in the cluster.
  3. Restart HDFS daemons across nodes for the property to take effect:
    $ stop-dfs.sh
    $ start-dfs.sh
    

How it works...

These parameters are default parameters, which control how often the Datanodes send updates and when a Datanode will expire or be marked dead. Remember that dfs.heartbeat.interval is in seconds and the dfs.heartbeat.interval parameter is in milliseconds.

So, when a Datanode is dead, for any reason, it will take 10 minutes and 30 seconds for Namenode to mark it as dead. This is not true whenever a graceful removal of a node is performed, as discussed in Chapter 1, Hadoop Architecture and Deployment. There are a lot of factors that govern when a Namenode marks a Datanode as dead and how quickly it does this. But, if the user simply shuts down a Datanode and executes hdfs dfsadmin –report, the node will still be seen there. The formula that defines when a Datanode is marked as stale is as follows:

Datanode Removal time = (2 x dfs.namenode.heartbeat.recheck-interval ) + (10 X dfs.heartbeat.interval
主站蜘蛛池模板: 漳平市| 子洲县| 敦化市| 漠河县| 古丈县| 六盘水市| 珠海市| 阳东县| 博白县| 罗山县| 衢州市| 清水河县| 扎鲁特旗| 涪陵区| 宁阳县| 河北区| 吉隆县| 松江区| 平凉市| 连平县| 界首市| 长阳| 吉首市| 若羌县| 韶山市| 隆尧县| 登封市| 无为县| 铜陵市| 宾阳县| 南澳县| 孟津县| 凤冈县| 富宁县| 疏附县| 陕西省| 麻江县| 涿州市| 西乡县| 会昌县| 利辛县|