【大數據系列】節點的退役和服役[datanode,yarn]


一、datanode添加新節點

dfs.include文件中包含新節點名稱,該文件在名稱節點的本地目錄下

     [白名單]

     [s201:/soft/hadoop/etc/hadoop/dfs.include]

2  hdfs-site.xml文件中添加屬性

 <property>

     <name>dfs.hosts</name>

     <value>/soft/hadoop/etc/dfs.include.txt</value>

   </property>

3 nn上刷新節點

Hdfs dfsadmin -refreshNodes

4 slaves文件中添加新節點ip(主機名)

5 單獨啟動新節點中的datanode

   Hadoop-daemon.sh start datanode

二、datanode退役舊節點

1 添加退役節點的ip到黑名單 dfs.hosts.exclude,不要更新白名單

   [/soft/hadoop/etc/dfs.hosts.exclude]

2 配置hdfs-site.xml

   <property>

     <name>dfs.hosts.exclude</name>

     <value>/soft/hadoop/etc/dfs.hosts.exclude.txt</value>

   </property>

3 刷新nn的節點

  hdfs dfsadmin -refreshNodes

4 查看WEBUI,節點狀態在Decommission  In Progress

5 當所有的要退役的節點都報告為Decommissioned,數據轉移工作已經完成

6 從白名單刪除節點,並刷新節點

   hdfs dfsadmin -refreshNodes

   yarn rmadmin -refreshNodes

7 slaves文件中刪除退役的節點

8 hdfs-site.xml文件內容

 

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License. See accompanying LICENSE file.
-->

<!-- Put site-specific property overrides in this file. -->

<configuration>
        <property>
                <name>dfs.replication</name>
                <value>3</value>
        </property>
        <property>
                <name>dfs.name.dir</name>
                <value>/soft/hadoop/name/</value>
        </property>
        <property>
                <name>dfs.data.dir</name>
                <value>/soft/hadoop/data</value>
        </property>
        <property>
                <name>dfs.namenode.fs-limits.min-block-size</name>
                <value>1024</value>
        </property>
        <property>
                <name>dfs.hosts.exclude</name>
                <value>/soft/hadoop/etc/dfs.hosts.exclude.txt</value>
        </property>
</configuration>

三、黑白名單組合結構

Include   //dfs.hosts

Exclude   //dfs.hosts.exclude

白名單   黑名單 組合結構
No No Node may not connect 
No Yes Node may not connect
Yes No Node may connect
Yes Yes Node may connect and will be decommissioned

四、圖文

黑名單文件

刷新節點信息

退役中

五、yarn添加新節點

1  dfs.include文件中包含新節點名稱,該文件在名稱節點的本地目錄下

     [白名單]

     [s201:/soft/hadoop/etc/hadoop/dfs.include]

2  yarn-site.xml文件中添加屬性

    <property>

     <name>yarn.resourcemanager.nodes.include-path</name>

     <value>/soft/hadoop/etc/dfs.include.txt</value>

   </property>

3 rm上刷新節點

yarn rmadmin-refreshNodes

4 slaves文件中添加新節點ip(主機名)

5 單獨啟動新節點中的資源管理器

   yarn-daemon.sh start nodemanager

六、yarn退役新節點

1 添加退役節點的ip到黑名單 dfs.hosts.exclude,不要更新白名單

   [/soft/hadoop/etc/dfs.hosts.exclude]

2 配置yarn-site.xml

   <property>

     <name>yarn-resourcemanager.nodes.exclude-path</name>

     <value>/soft/hadoop/etc/dfs.hosts.exclude.txt</value>

   </property>

3 刷新rm的節點

  yarn rmadmin -refreshNodes

4 查看WEBUI,節點狀態在Decommission  In Progress

5 當所有的要退役的節點都報告為Decommissioned,數據轉移工作已經完成

6 從白名單刪除節點,並刷新節點

    yarn rmadmin -refreshNodes

7 slaves文件中刪除退役的節點

 注意:因為退役的時候副本數沒有改變。所以要在退役的時候增加新的節點,只是做退役的話,因為不滿足最小副本數要求,一直會停留在退役中,如果想更快的退役的話要使得退役后的副本數仍然達到最小副本數要求。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM