设为首页 收藏本站
查看: 498|回复: 0

[经验分享] Commissioning and Decommissioning Nodes from Hadoop Cluster

[复制链接]

尚未签到

发表于 2016-12-9 08:49:09 | 显示全部楼层 |阅读模式
Nodes in Hadoop cluster run both a datanode and a tasktracker, and both are typically commissioned or decommissioned in tandem.
 
Commissioning new nodes
Commissioning a new node can be as simple as configuring the hdfs-site.xml file to point to the namenode, configuring the mapred-site.xml file to point to the jobtracker, and starting the datanode and jobtracker daemons. Although from security perspective you'd better to have a list of authorized nodes.
 
Datanodes that are permitted to connect to the namenode are specified in a file whose name is specified by the dfs.hosts property. The file reside on the namenode's local filesystem, and it contains a line for each datanode, specified by network address. If you need to specified multiple network addresses for a datanode, put them on one line, separated by whitespace.
 
Tasktrackers that may connect to the jobtracker are specified in a file whose name is specified by the mapred.hosts property. In most cases, there is one shared file, referred as the include file, that both dfs.hosts and mapred.hosts refer to, since nodes in the cluster run both datanode and tasktracker daemons.
 
To add new nodes to the cluster:


  • Add the network address of the new nodes to the include file.

  • Update the namenode with the new set of permitted datanodes using this command:
    $ hadoop dfsadmin -refreshNodes
     

  • Update the jobtracker with the new set of permitted tasktrackers using:
    $ hadoop mradmin -refreshNodes
     
  • Update the slaves file with the new nodes, so that they are included in future operations performed by the hadoop control scripts.
  • Start the new datanodes and tasktrackers.
  • Check that the new datanodes and tasktrackers apprer in the web UI.

HDFS will not move blocks from old datanodes to new datanodes to balance the cluster. To do this, you should run the balancer manually by:

$ start-balancer.sh
 
The -threshold argument specified the threshold percentage that defines what it means for the cluster to be balanced. The flag is optional, in which case the threshold is 10%.
 
 
Decommissioning old nodes
The way to decommission datanodes is to inform the namenode of the nodes that you wish to take out of circulation, so that it can replicate the blocks to other datanodes before the datanodes are shutdown.
 
The decommissioning process is controlled by an exclude file, which for HDFS is set by the dfs.hosts.exclude property and for MapReduce by the mapred.hosts.exclude property. It is often the case that these properties refer to the same file. The exclude file lists the nodes that are not permitted tot connect to the cluster.
 
To remove nodes from the cluster:


  • Add the network address of the nodes to be decommissioned to the exclude file. Do not update the include file at this point.

  • Update the namenode with the new set of permitted datanodes, using this command:
    $ hadoop dfsadmin -refreshNodes
     

  • Update the jobtracker with the new set of permitted tasktracker using:
    $ hadoop mradmin -refreshNodes
     
  • Go to the web UI and check whether the admin state has changed to "Decommission in Progress" for the datanodes being decommissioned. They will start copying their blocks to other datanodes in the cluster.
  • When all the datanodes report their state as "Decommissioned", all the blocks have been replicated. Shut down the decommissioned nodes.

  • Remove the nodes from the include file, and run:
    $ hadoop dfsadmin -refreshNodes
    $ hadoop mradmin -refreshNodes
      
  • Remove the nodes from the slaves file.

Actually, to decommission or recommission a node from Hadoop cluster manually is too involved. With cloudera manager, it easy to do the job without too involved into the fussy configuration. Below is the steps to decommission and recommission a node in a Hadoop cluster using Cloudera Manager.
 
Decommission one or more hosts:


  • Click the Hosts tab.
  • Select the host(s) you want to decommission.
    DSC0000.png
     

  • From the Actions for Selected menu, click Decommission.
  • A confirmation pop-up informs you of the roles that will be decommissioned or stopped on the nodes you have selected. To proceed with the decommissioning, click Confirm.

    DSC0001.png
     


  • A Command Details window appears that will show each stop or decommission command as it is run, service by service. You can click one of the decommission links to see the subcommands that are run for decommissioning a given role. Depending on the role, the steps may include adding the node to an "exclusions list" and refreshing the NameNode, JobTracker, or NodeManager, stopping the Balancer (if it is running), and moving data blocks or regions. Roles that do not have specific decommission actions are just stopped.



While decommissioning is in progress, the host is marked Decommissioning in the list under the Hosts tab. Once all roles have been decommissioned or stopped, the host is marked Decommissioned.
DSC0002.png
 

Roles on a decommissioned host cannot be restarted until the host is recommissioned.
 
Recommissioning a Host
Only hosts that are decommissioned using Cloudera Manager can be recommissioned.


  • Click the Hosts tab.
  • Select the host(s) you want to recommission.
    DSC0003.png
     

  • From the Actions for Selected menu, click recommission.
    DSC0004.png
     


This will recommission the host (i.e. remove it from the exclusion lists and run the appropriate refresh) so that the roles that reside on it can be restarted. The Decommissioned indicator is removed from the host. It also removes the Decommissioned indicator from the roles that reside on the host. However, the roles themselves are NOT restarted by the recommission command.
You can restart all the roles on a recommissioned host in a single command from the Hosts page:


  • Select the host(s) on which you want to start the decommissioned roles.
  • From the Actions for Selected menu, click Start All Roles.
    DSC0005.png
     
    DSC0006.png
     

  Run the Balancer to rebalance the cluster:
  1. On the HDFS > Status tab, choose Rebalance on the Actions menu.
DSC0007.png
 

  2. Click Rebalance that appears in the next screen to confirm.
DSC0008.png
 If you see a Finished status, the Balancer 
successfully ran and completed.

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-311698-1-1.html 上篇帖子: hadoop-map-reduce执行流程调研报告 下篇帖子: 【Hadoop八】Yarn的资源调度策略
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表