1. 程式人生 > >HDFS和HBASE動態增加和減少節點

HDFS和HBASE動態增加和減少節點

一.HDFS動態增加節點:


sbin/hadoop-daemon.sh start datanode
sbin/hadoop-daemon.sh start tasktracker
DEPRECATED: Use of this script to execute mapred command is deprecated.
Instead use the mapred command for it.


Sorry, the tasktracker command is no longer supported.
You may find similar functionality with the "yarn" shell command.
Usage: mapred [--config confdir] [--loglevel loglevel] COMMAND
       where COMMAND is one of:
  pipes                run a Pipes job
  job                  manipulate MapReduce jobs
  queue                get information regarding JobQueues


(1)啟動datanode程序 
sbin/hadoop-daemon.sh start datanode
(2)啟動nodemanager程序 
sbin/yarn-daemon.sh start nodemanager 
(3)均衡block 
sbin/start-balancer.sh


1.問題:yarn
http://192.168.13.129:8088/cluster/nodes/?node.label=
兩次出現新增的節點,節點重複,過一會兒會消失


二.hbase增加Region Servers
(1)
HMaster節點的配置regionservers
[
[email protected]
hbase-1.3.0]# cat conf/regionservers node02 node03 node04 (2) 在新節點中通過下面命令啟動HRegionServer: hbase-daemon.sh start regionserver (3)驗證HRegionServer: [[email protected] hadoop-2.7.3]# jps 3890 DataNode 4615 Jps 3975 NodeManager 4456 HRegionServer 1913 QuorumPeerMain 三.hbase刪除Region Servers hbase-daemon.sh stop regionserver (1) 在需要刪除的RegionServer上執行以下命令:$ ./bin/hbase-daemon.sh stop regionserver RegionServer將會關掉所有的region,然後此節點將會在Zookeeper消失。Master注意到了此RegionServer 掉了,它將會重新分配掉的這些Region。在停掉一個節點的時候,注意要關閉Load Balancer,因為Load Balancer可能要和Master的恢復機制爭奪停掉的RegionServer (2) hbase(main):001:0> balance_switch false true (3) graceful_stop.sh node04 Valid region move targets: node03,16020,1491575709589 node02,16020,1491575710085 2017-04-08T00:42:10 Unloaded node04 region(s) 2017-04-08T00:42:10 Stopping regionserver on node04 stopping regionserver......... (4) [
[email protected]
hadoop-2.7.3]# hbase-daemon.sh stop regionserver no regionserver to stop because no pid file /tmp/hbase-root-regionserver.pi (5) hbase(main):001:0> balance_switch true 四.HDFS移除節點: (1)新增黑名單檔案 在主節點的Hadoop安裝目錄目錄下新增檔案excludes 和slaves類似每個節點名一行 新增上要移除的節點名node04 例如: echo 'node04' > excludes [
[email protected]
hadoop-2.7.3]# cat /app/hadoop-2.7.3/excludes node04 (2)修改hdfs-site.xml 新增下列程式碼,路徑為自己的excludes檔案路徑 <property> <name>dfs.hosts.exclude</name> <value>/app/hadoop-2.7.3/excludes</value> </property> (3)修改mapred-site.xml 新增下列程式碼,路徑為自己的excludes檔案路徑 <property> <name>mapred.hosts.exclude</name> <value>/app/hadoop-2.7.3/excludes</value> </property> (4)重新整理 在主節點hadoop安裝目錄下執行下面命令 hadoop dfsadmin -refreshNodes (5)在web上檢視節點效果 node04:50010 (192.168.13.131:50010) 0Decommission In Progress 7.6 GB 一開始是Decommission In Progress,正在退役 node04:50010 (192.168.13.131:50010) 1Decommissioned 7.6 GB 執行完後狀態修改為Decommissioned,表示已退役 (6)slaves刪除node04 [[email protected] hadoop-2.7.3]# cat /app/hadoop-2.7.3/etc/hadoop/slaves node02 node03


支援原創

公眾號:clark_blog
部落格:blog.csdn.net/clark_xu

程式碼:https://github.com/clark99