Hadoop 2.7.4 HDFS+YRAN HA删除datanode和nodemanager

Stella981
• 阅读 793

当前集群

主机名称

IP地址

角色

统一安装目录

统一安装用户

sht-sgmhadoopnn-01

172.16.101.55

namenode,resourcemanager

/usr/local/hadoop(软连接)

/usr/local/hadoop-2.7.4

/usr/local/zookeeper(软连接)

/usr/local/zookeeper-3.4.9

root

sht-sgmhadoopnn-02

172.16.101.56

namenode,resourcemanager

sht-sgmhadoopdn-01

172.16.101.58

datanode,nodemanager,journalnode,zookeeper

sht-sgmhadoopdn-02

172.16.101.59

datanode,nodemanager,journalnode,zookeeper

sht-sgmhadoopdn-03

172.16.101.60

datanode,nodemanager,journalnode,zookeeper

sht-sgmhadoopdn-04

172.16.101.66

datanode,nodemanager

因sht-sgmhadoopdn-04节点异常,需要从当前集群剔除

1. 在active节点sht-sgmhadoopnn-01修改配置文件

slaves

sht-sgmhadoopdn-01
sht-sgmhadoopdn-02
sht-sgmhadoopdn-03

hdfs-site.xml

<property>
        <name>dfs.replication</name>
        <value>3</value>
  </property>

hdfs-site.xml

<property>
        <name>dfs.hosts</name>
        <value>/usr/local/hadoop/etc/hadoop/hdfs_includes</value>
  </property>

  <property>
        <name>dfs.hosts.exclude</name>
        <value>/usr/local/hadoop/etc/hadoop/hdfs_excludes</value>
  </property>

yarn-site.xml

<property>
        <name>dfs.hosts</name>
        <value>/usr/local/hadoop/etc/hadoop/yarn_includes</value>
  </property>

  <property>
        <name>dfs.hosts.exclude</name>
        <value>/usr/local/hadoop/etc/hadoop/yarn_excludes</value>
  </property>

如果存在上述hosts配置,则可以直接进入第二步,否则,需要将上述参数添加至对应文件里,并重启hdfs和yarn集群

 2. 添加白名单和黑名单

白名单

# echo sht-sgmhadoopdn-01 > /usr/local/hadoop/etc/hadoop/hdfs_includes
# echo sht-sgmhadoopdn-02 > /usr/local/hadoop/etc/hadoop/hdfs_includes
# echo sht-sgmhadoopdn-03 > /usr/local/hadoop/etc/hadoop/hdfs_includes

黑名单

# echo sht-sgmhadoopdn-04 > /usr/local/hadoop/etc/hadoop/hdfs_excludes
# echo sht-sgmhadoopdn-04 > /usr/local/hadoop/etc/hadoop/yarn_excludes

在所有节点更新上述参数

3. 在active节点sht-sgmhadoopnn-01刷新节点信息

此命令告诉resourcemanager重新读取配置文件yarn-site.xml,将存在yarn_excludes文件中的节点退出当前yarn集群,并不在分配job到该节点

# yarn rmadmin -refreshNodes

输出log

Hadoop 2.7.4 HDFS+YRAN HA删除datanode和nodemanager Hadoop 2.7.4 HDFS+YRAN HA删除datanode和nodemanager

2019-03-30 00:40:48,751 INFO org.apache.hadoop.conf.Configuration: found resource yarn-site.xml at file:/usr/local/hadoop-2.7.4/etc/hadoop/yarn-site.xml
2019-03-30 00:40:48,755 INFO org.apache.hadoop.util.HostsFileReader: Setting the includes file to /usr/local/hadoop/etc/hadoop/yarn_includes
2019-03-30 00:40:48,755 INFO org.apache.hadoop.util.HostsFileReader: Setting the excludes file to /usr/local/hadoop/etc/hadoop/yarn_excludes
2019-03-30 00:40:48,755 INFO org.apache.hadoop.util.HostsFileReader: Refreshing hosts (include/exclude) list
2019-03-30 00:40:48,755 INFO org.apache.hadoop.util.HostsFileReader: Adding sht-sgmhadoopdn-01 to the list of included hosts from /usr/local/hadoop/etc/hadoop/yarn_includes
2019-03-30 00:40:48,755 INFO org.apache.hadoop.util.HostsFileReader: Adding sht-sgmhadoopdn-02 to the list of included hosts from /usr/local/hadoop/etc/hadoop/yarn_includes
2019-03-30 00:40:48,755 INFO org.apache.hadoop.util.HostsFileReader: Adding sht-sgmhadoopdn-03 to the list of included hosts from /usr/local/hadoop/etc/hadoop/yarn_includes
2019-03-30 00:40:48,756 INFO org.apache.hadoop.util.HostsFileReader: Adding sht-sgmhadoopdn-04 to the list of excluded hosts from /usr/local/hadoop/etc/hadoop/yarn_excludes
2019-03-30 00:40:48,757 INFO org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeImpl: Deactivating Node sht-sgmhadoopdn-04:21570 as it is now DECOMMISSIONED
2019-03-30 00:40:48,758 INFO org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeImpl: sht-sgmhadoopdn-04:21570 Node Transitioned from RUNNING to DECOMMISSIONED
2019-03-30 00:40:48,756 INFO org.apache.hadoop.yarn.server.resourcemanager.RMAuditLogger: USER=root    IP=172.16.101.55    OPERATION=refreshNodes    TARGET=AdminService    RESULT=SUCCESS
2019-03-30 00:40:48,772 INFO org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler: Removed node sht-sgmhadoopdn-04:21570 clusterResource: <memory:12288, vCores:24>
2019-03-30 00:40:48,909 INFO org.apache.hadoop.yarn.server.resourcemanager.ResourceTrackerService: Disallowed NodeManager nodeId: sht-sgmhadoopdn-04:21570 hostname: sht-sgmhadoopdn-04

View Code

nodemanager输出log

Hadoop 2.7.4 HDFS+YRAN HA删除datanode和nodemanager Hadoop 2.7.4 HDFS+YRAN HA删除datanode和nodemanager

2019-03-30 00:40:48,910 WARN org.apache.hadoop.yarn.server.nodemanager.NodeStatusUpdaterImpl: Recieved SHUTDOWN signal from Resourcemanager as part of heartbeat, hence shutting down.
2019-03-30 00:40:48,910 WARN org.apache.hadoop.yarn.server.nodemanager.NodeStatusUpdaterImpl: Message from ResourceManager: Disallowed NodeManager nodeId: sht-sgmhadoopdn-04:21570 hostname: sht-sgmhadoopdn-04
2019-03-30 00:40:49,023 INFO org.mortbay.log: Stopped HttpServer2$SelectChannelConnectorWithSafeStartup@0.0.0.0:8042
2019-03-30 00:40:49,125 INFO org.apache.hadoop.ipc.Server: Stopping server on 21570
2019-03-30 00:40:49,133 INFO org.apache.hadoop.ipc.Server: Stopping IPC Server Responder
2019-03-30 00:40:49,133 INFO org.apache.hadoop.ipc.Server: Stopping IPC Server listener on 21570
2019-03-30 00:40:49,135 WARN org.apache.hadoop.yarn.server.nodemanager.containermanager.monitor.ContainersMonitorImpl: org.apache.hadoop.yarn.server.nodemanager.containermanager.monitor.ContainersMonitorImpl is interrupted. Exiting.
2019-03-30 00:40:49,154 INFO org.apache.hadoop.ipc.Server: Stopping server on 8040
2019-03-30 00:40:49,159 INFO org.apache.hadoop.ipc.Server: Stopping IPC Server listener on 8040
2019-03-30 00:40:49,159 INFO org.apache.hadoop.ipc.Server: Stopping IPC Server Responder
2019-03-30 00:40:49,160 INFO org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ResourceLocalizationService: Public cache exiting
2019-03-30 00:40:49,162 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: Stopping NodeManager metrics system...
2019-03-30 00:40:49,163 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: NodeManager metrics system stopped.
2019-03-30 00:40:49,163 INFO org.apache.hadoop.metrics2.impl.MetricsSystemImpl: NodeManager metrics system shutdown complete.
2019-03-30 00:40:49,178 INFO org.apache.hadoop.util.ExitUtil: Exiting with status -1
2019-03-30 00:40:49,182 INFO org.apache.hadoop.yarn.server.nodemanager.NodeManager: SHUTDOWN_MSG: 
/************************************************************
SHUTDOWN_MSG: Shutting down NodeManager at sht-sgmhadoopdn-04/172.16.101.66
************************************************************/

View Code

此命令告诉hdfs重新读取配置文件hdfs-site.xml,将存在hdfs_excludes文件中的节点退出当前hdfs集群。

# hdfs dfsadmin -refreshNodes

 输出log

Hadoop 2.7.4 HDFS+YRAN HA删除datanode和nodemanager Hadoop 2.7.4 HDFS+YRAN HA删除datanode和nodemanager

2019-03-30 00:43:00,576 INFO org.apache.hadoop.util.HostsFileReader: Adding sht-sgmhadoopdn-01 to the list of included hosts from /usr/local/hadoop/etc/hadoop/hdfs_includes
2019-03-30 00:43:00,576 INFO org.apache.hadoop.util.HostsFileReader: Adding sht-sgmhadoopdn-02 to the list of included hosts from /usr/local/hadoop/etc/hadoop/hdfs_includes
2019-03-30 00:43:00,576 INFO org.apache.hadoop.util.HostsFileReader: Adding sht-sgmhadoopdn-03 to the list of included hosts from /usr/local/hadoop/etc/hadoop/hdfs_includes
2019-03-30 00:43:00,577 INFO org.apache.hadoop.util.HostsFileReader: Adding sht-sgmhadoopdn-04 to the list of excluded hosts from /usr/local/hadoop/etc/hadoop/hdfs_excludes
2019-03-30 00:43:01,266 INFO org.apache.hadoop.ipc.Server: IPC Server handler 5 on 8020, call org.apache.hadoop.hdfs.server.protocol.DatanodeProtocol.sendHeartbeat from 172.16.101.66:16197 Call#1641 Retry#0
org.apache.hadoop.hdfs.server.protocol.DisallowedDatanodeException: Datanode denied communication with namenode because the host is not in the include-list: 172.16.101.66:50010
    at org.apache.hadoop.hdfs.server.blockmanagement.DatanodeManager.handleHeartbeat(DatanodeManager.java:1340)
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.handleHeartbeat(FSNamesystem.java:4512)
    at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.sendHeartbeat(NameNodeRpcServer.java:1298)
    at org.apache.hadoop.hdfs.protocolPB.DatanodeProtocolServerSideTranslatorPB.sendHeartbeat(DatanodeProtocolServerSideTranslatorPB.java:114)
    at org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos$DatanodeProtocolService$2.callBlockingMethod(DatanodeProtocolProtos.java:28754)
    at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:616)
    at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:982)
    at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2217)
    at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2213)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:422)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1746)
    at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2213)
2019-03-30 00:43:28,046 INFO org.apache.hadoop.hdfs.StateChange: BLOCK* removeDeadDatanode: lost heartbeat from 172.16.101.66:50010
2019-03-30 00:43:28,051 INFO org.apache.hadoop.net.NetworkTopology: Removing a node: /default-rack/172.16.101.66:50010

View Code

datanode输出log

Hadoop 2.7.4 HDFS+YRAN HA删除datanode和nodemanager Hadoop 2.7.4 HDFS+YRAN HA删除datanode和nodemanager

2019-03-30 00:43:01,270 WARN org.apache.hadoop.hdfs.server.datanode.DataNode: Block pool BP-698223843-172.16.101.55-1553701973789 (Datanode Uuid 30bc4855-5dca-412a-bf9a-9529bcfe3ea0) service to sht-sgmhadoopnn-01/172.16.101.55:8020 is shutting down
org.apache.hadoop.ipc.RemoteException(org.apache.hadoop.hdfs.server.protocol.DisallowedDatanodeException): Datanode denied communication with namenode because the host is not in the include-list: 172.16.101.66:50010
    at org.apache.hadoop.hdfs.server.blockmanagement.DatanodeManager.handleHeartbeat(DatanodeManager.java:1340)
    at org.apache.hadoop.hdfs.server.namenode.FSNamesystem.handleHeartbeat(FSNamesystem.java:4512)
    at org.apache.hadoop.hdfs.server.namenode.NameNodeRpcServer.sendHeartbeat(NameNodeRpcServer.java:1298)
    at org.apache.hadoop.hdfs.protocolPB.DatanodeProtocolServerSideTranslatorPB.sendHeartbeat(DatanodeProtocolServerSideTranslatorPB.java:114)
    at org.apache.hadoop.hdfs.protocol.proto.DatanodeProtocolProtos$DatanodeProtocolService$2.callBlockingMethod(DatanodeProtocolProtos.java:28754)
    at org.apache.hadoop.ipc.ProtobufRpcEngine$Server$ProtoBufRpcInvoker.call(ProtobufRpcEngine.java:616)
    at org.apache.hadoop.ipc.RPC$Server.call(RPC.java:982)
    at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2217)
    at org.apache.hadoop.ipc.Server$Handler$1.run(Server.java:2213)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:422)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1746)
    at org.apache.hadoop.ipc.Server$Handler.run(Server.java:2213)

    at org.apache.hadoop.ipc.Client.call(Client.java:1476)
    at org.apache.hadoop.ipc.Client.call(Client.java:1413)
    at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:229)
    at com.sun.proxy.$Proxy15.sendHeartbeat(Unknown Source)
    at org.apache.hadoop.hdfs.protocolPB.DatanodeProtocolClientSideTranslatorPB.sendHeartbeat(DatanodeProtocolClientSideTranslatorPB.java:152)
    at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.sendHeartBeat(BPServiceActor.java:402)
    at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.offerService(BPServiceActor.java:500)
    at org.apache.hadoop.hdfs.server.datanode.BPServiceActor.run(BPServiceActor.java:659)
    at java.lang.Thread.run(Thread.java:745)
2019-03-30 00:43:01,272 WARN org.apache.hadoop.hdfs.server.datanode.DataNode: Ending block pool service for: Block pool BP-698223843-172.16.101.55-1553701973789 (Datanode Uuid 30bc4855-5dca-412a-bf9a-9529bcfe3ea0) service to sht-sgmhadoopnn-01/172.16.101.55:8020

View Code

4. 执行hdfs集群负载均衡

# hdfs dfs -setrep -R -w 3  /

输出log

Hadoop 2.7.4 HDFS+YRAN HA删除datanode和nodemanager Hadoop 2.7.4 HDFS+YRAN HA删除datanode和nodemanager

# hdfs dfs -setrep -R -w 3  /
Replication 3 set: /CentOS-6.8-x86_64-bin-DVD2.iso
Replication 3 set: /hadoop-2.8.1.tar.gz
Replication 3 set: /slaves
Replication 3 set: /yarn-env.sh
Waiting for /CentOS-6.8-x86_64-bin-DVD2.iso ...
WARNING: the waiting time may be long for DECREASING the number of replications.
............................................................................................... done
Waiting for /hadoop-2.8.1.tar.gz ... done
Waiting for /slaves ... done
Waiting for /yarn-env.sh ... done

View Code

5.停止sht-sgmhadoopdn-04节点的datanode和nodemanager角色

6. 清空各节点黑白名单

# echo > /usr/local/hadoop/etc/hadoop/hdfs_excludes
# echo > /usr/local/hadoop/etc/hadoop/yarn_excludes
# echo > /usr/local/hadoop/etc/hadoop/hdfs_includes
# echo > /usr/local/hadoop/etc/hadoop/yarn_includes

 7. 在适当时候建议重启hdfs和yarn集群

点赞
收藏
评论区
推荐文章
blmius blmius
3年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
皕杰报表之UUID
​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为
待兔 待兔
3个月前
手写Java HashMap源码
HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22
Jacquelyn38 Jacquelyn38
3年前
2020年前端实用代码段,为你的工作保驾护航
有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )
Stella981 Stella981
3年前
List的Select 和Select().tolist()
List<PersondelpnewList<Person{newPerson{Id1,Name"小明1",Age11,Sign0},newPerson{Id2,Name"小明2",Age12,
Wesley13 Wesley13
3年前
mysql设置时区
mysql设置时区mysql\_query("SETtime\_zone'8:00'")ordie('时区设置失败,请联系管理员!');中国在东8区所以加8方法二:selectcount(user\_id)asdevice,CONVERT\_TZ(FROM\_UNIXTIME(reg\_time),'08:00','0
Wesley13 Wesley13
3年前
00:Java简单了解
浅谈Java之概述Java是SUN(StanfordUniversityNetwork),斯坦福大学网络公司)1995年推出的一门高级编程语言。Java是一种面向Internet的编程语言。随着Java技术在web方面的不断成熟,已经成为Web应用程序的首选开发语言。Java是简单易学,完全面向对象,安全可靠,与平台无关的编程语言。
Stella981 Stella981
3年前
Django中Admin中的一些参数配置
设置在列表中显示的字段,id为django模型默认的主键list_display('id','name','sex','profession','email','qq','phone','status','create_time')设置在列表可编辑字段list_editable
Wesley13 Wesley13
3年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_
Python进阶者 Python进阶者
9个月前
Excel中这日期老是出来00:00:00,怎么用Pandas把这个去除
大家好,我是皮皮。一、前言前几天在Python白银交流群【上海新年人】问了一个Pandas数据筛选的问题。问题如下:这日期老是出来00:00:00,怎么把这个去除。二、实现过程后来【论草莓如何成为冻干莓】给了一个思路和代码如下:pd.toexcel之前把这