环境说明
192.168.100.101 node01
192.168.100.102 node02
192.168.100.103 node03
192.168.100.104 node04
四台Vmware Workstatuin中搭建的centos6.9主机,hadoop版本为2.6.0
①创建etc/hadoop/dfs.hosts.exclude配置文件,并添加需要退役的节点
[root@node01 hadoop]# cat dfs.hosts.exclude
node04
②修改hdfs-site.xml,添加修改hdfs-site.xml属性
<property>
<name>dfs.hosts.exclude</name>
<value>/export/servers/hadoop-2.6.0-cdh5.14.0/etc/hadoop/dfs.hosts.exclude</value>
</property>
③namenode节点刷新namenode,刷新resourceManager
hdfs dfsadmin -refreshNodes
yarn rmadmin -refreshNodes
④节点退役完成,停止该节点进程
[root@node01 hadoop]# hadoop-daemon.sh stop datanode
stopping datanode
[root@node01 hadoop]# yarn-daemon.sh stop nodemanager
stopping nodemanager
⑤从dfs.hosts文件中删除退役节点
[root@node01 hadoop]# cat dfs.hosts
node01
node02
node03
⑥namenode节点刷新namenode,刷新resourceManager
hdfs dfsadmin -refreshNodes
yarn rmadmin -refreshNodes
⑦从namenode的slave文件中删除退役节点
[root@node01 hadoop]# cat slaves
node01
node02
node03
⑧负载均衡
start-balancer.sh
文章评论