集群添加节点

1.添加之前要将需要进行添加的新节点进行如下配置:
  1. 修改主机名

vi /etc/sysconfig/network

  1. 永久关闭防火墙

/etc/init.d/iptables stop
chkconfig iptables off

  1. 关闭selinux

vi /etc.selinux/config
修改 SELINUX=disabled

  1. 修改所有节点的 /etc/hosts 文件。添加新的节点的IP和主机名
  2. 安装jdk;
2.将主机添加到集群

a) 在hadoop配置文件路径下创建dfs.hosts(白名单:可以和NN通信的所有节点)文件
b) 在白名单中添加可以通信的所有DataNode

d) 在hdfs-site.xml中添加一下配置

 <property> 
 <name>dfs.hosts</name>              
 <value>/export/servers/hadoop-2.6.0cdh5.14.0/etc/hadoop/dfs.hosts</value>
 </property>

e) 刷新NameNode和ResourceManager

hdfs dfsadmin –refreshNodes
yarn rmadmin –refreshNodes

f) 启动新节点的DataNode 和NodeManager

sbin/hadoop-daemon.sh start datanode
sbin/yarn-daemon.sh start nodemanager

g) 验证


集群删除节点

第一步:创建dfs.hosts.exclude配置文件
在hadoop的配置文件目录下创建dfs.hosts.exclude文件,也就是黑名单
第二步:在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和ResourceManager

i.	hdfs dfsadmin -refreshNodes
ii.	yarn rmadmin –refreshNodes

第四步:在白名单(dfs.hosts文件中)中删除掉退役的节点

第五步:在slaves文件中删除掉退役的节点

第六步:负载均衡

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐