【hadoop 2.7.1 】動態添加節點、刪除節點

hftest0001node

hftest0002web

hftest0003shell


1、動態添加節點oop

hftest0001 (master node )ui

[hadoop@hftest0001 hadoop]$ pwd
/home/hadoop/hadoop-2.7.1/etc/hadoop

[hadoop@hftest0001 hadoop]$ cat masters 
hftest0001.webex.com
[hadoop@hftest0001 hadoop]$ cat slaves 
hftest0002.webex.com

[hadoop@hftest0001 hadoop]$ cat hdfs-site.xml
<configuration>
	<property>
		<name>dfs.replication</name>
		<value>1</value>
	</property>
...
...
<configuration>

hftest0002 (data node)spa

[hadoop@hftest0002 hadoop]$ pwd
/home/hadoop/hadoop-2.7.1/etc/hadoop

[hadoop@hftest0002 hadoop]$ cat masters 
hftest0001.webex.com
[hadoop@hftest0002 hadoop]$ cat slaves 
hftest0002.webex.com

[hadoop@hftest0002 hadoop]$ cat hdfs-site.xml
<configuration>
	<property>
		<name>dfs.replication</name>
		<value>1</value>
	</property>
...
...
<configuration>
[hadoop@hftest0001 hadoop-2.7.1]$ ./bin/hdfs dfs -ls /tmp
Found 1 items
-rw-r--r--   1 hadoop supergroup       1366 2016-01-28 13:48 /tmp/README.txt  ===> replication 1


準備:code

建立新節點hftest0003xml

修改hostname(/etc/sysconf/network) 和 hosts(/etc/hosts) 使得集羣相互ping通hadoop

修改slaves文件,添加新節點
it

修改replication=>2

[hadoop@hftest0001 hadoop]$ pwd
/home/hadoop/hadoop-2.7.1/etc/hadoop

[hadoop@hftest0003 hadoop]$ cat masters 
hftest0001.webex.com
[hadoop@hftest0003 hadoop]$ cat slaves 
hftest0002.webex.com
hftest0003.webex.com

[hadoop@hftest0003 hadoop]$ cat hdfs-site.xml
<configuration>
	<property>
		<name>dfs.replication</name>
		<value>2</value>
	</property>
...
...
<configuration>

注意:全部的集羣所有須要修改

[hadoop@hftest0001 hadoop-2.7.1]$ pwd
/home/hadoop/hadoop-2.7.1

啓動datanode
[hadoop@hftest0001 hadoop-2.7.1]$ ./sbin/hadoop-daemon.sh start datanode
...
...

webui能夠校驗

[hadoop@hftest0001 hadoop-2.7.1]$ ./sbin/start-balancer.sh -threshold 5

啓動nodemanager
[hadoop@hftest0001 hadoop-2.7.1]$ ./sbin/yarn-daemon.sh start nodemanager
...
...

[hadoop@hftest0001 hadoop-2.7.1]$ ./bin/hdfs dfs -ls /tmp
Found 2 items
-rw-r--r--   2 hadoop supergroup        101 2016-01-28 13:54 /tmp/NOTICE.txt ====> replication=2
-rw-r--r--   1 hadoop supergroup       1366 2016-01-28 13:48 /tmp/README.txt

2、刪除節點

相關文章
相關標籤/搜索