添加白名单
添加到白名单的主机节点,都允许访问NameNode,不在白名单的主机节点,都会被退出。
配置白名单的具体步骤如下:
(1)在NameNode的/opt/module/hadoop-2.7.2/etc/hadoop目录下创建dfs.hosts文件
[hfx@hadoop102 hadoop]$ pwd
/opt/module/hadoop-2.7.2/etc/hadoop
[hfx@hadoop102 hadoop]$ touch dfs.hosts
[hfx@hadoop102 hadoop]$ vi dfs.hosts
添加如下主机名称(不添加hadoop105)
hadoop102
hadoop103
hadoop104
(2)在NameNode的hdfs-site.xml配置文件中增加dfs.hosts属性
(3)配置文件分发
[hfx@hadoop102 hadoop]$ xsync hdfs-site.xml
(4)刷新NameNode
[hfx@hadoop102 hadoop-2.7.2]$ hdfs dfsadmin -refreshNodes
Refresh nodes successful
(5)更新ResourceManager节点
[hfx@hadoop102 hadoop-2.7.2]$ yarn rmadmin -refreshNodes
17/06/24 14:17:11 INFO client.RMProxy: Connecting to ResourceManager at hadoop103/192.168.1.103:8033
(6)在web浏览器上查看
(7)如果数据不均衡,可以用命令实现集群的再平衡
[hfx@hadoop102 sbin]$ ./start-balancer.sh
黑名单退役
在黑名单上面的主机都会被强制退出。
1.在NameNode的/opt/module/hadoop-2.7.2/etc/hadoop目录下创建dfs.hosts.exclude文件
[hfx@hadoop102 hadoop]$ pwd
/opt/module/hadoop-2.7.2/etc/hadoop
[hfx@hadoop102 hadoop]$ touch dfs.hosts.exclude
[hfx@hadoop102 hadoop]$ vi dfs.hosts.exclude
添加如下主机名称(要退役的节点)
hadoop105
2.在NameNode的hdfs-site.xml配置文件中增加dfs.hosts.exclude属性
3.刷新NameNode、刷新ResourceManager
[hfx@hadoop102 hadoop-2.7.2]$ hdfs dfsadmin -refreshNodes
Refresh nodes successful
[hfx@hadoop102 hadoop-2.7.2]$ yarn rmadmin -refreshNodes
17/06/24 14:55:56 INFO client.RMProxy: Connecting to ResourceManager at hadoop103/192.168.1.103:8033
检查Web浏览器,退役节点的状态为decommission in progress(退役中),说明数据节点正在复制块到其他节点,如图3-17所示
原文:https://www.cnblogs.com/sgjk/p/12307899.html