5个节点,配置如下:
dual core x86_64, 4GB RAM, 10GB Disk
Centos 6.4_x64
OpenJDK 1.7.0_9
hadoop-2.1.0-beta
互相之间千兆网连接。
每台机器上用于安装和启动hadoop的用户名都是xc
节点的hostname、安装的服务和ip如下:
hostname | 安装服务 | ip |
h1-1 | NN | 172.16.0.198 |
h1-2 | RM + SNN | 172.16.0.199 |
h1-3 | NM + DN | 172.16.0.200 |
h1-4 | NM + DN | 172.16.0.201 |
h1-5 | NM + DN | 172.16.0.202 |
172.16.0.198 h1-1 172.16.0.199 h1-2 172.16.0.200 h1-3 172.16.0.201 h1-4 172.16.0.202 h1-5
<configuration> <property> <name>fs.defaultFS</name> <value>hdfs://h1-1:9000</value> </property> </configuration>
<configuration> <property> <name>dfs.namenode.name.dir</name> <value>/home/xc/dfs/name</value> </property> <property> <name>dfs.datanode.data.dir</name> <value>/home/xc/dfs/data</value> </property> <property> <name>dfs.replication</name> <value>3</value> </property> </configuration>
<configuration> <property> <name>mapreduce.framework.name</name> <value>yarn</value> </property> <property> <name>mapreduce.jobhistory.address</name> <value>h1-2:10020</value> </property> <property> <name>mapreduce.jobhistory.webapp.address</name> <value>h1-2:19888</value> </property> <property> <name>mapreduce.jobhistory.intermediate-done-dir</name> <value>/mr-history/tmp</value> </property> <property> <name>mapreduce.jobhistory.done-dir</name> <value>/mr-history/done</value> </property> </configuration>虽然这里配置了jobhistory的web端口,但启动hadoop后,访问这个端口没有响应。telnet上面那两个端口也木有响应,暂时不知道为毛,但是不影响hdfs和跑mapreduce。
<configuration> <property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce.shuffle</value> </property> <property> <description>The address of the applications manager interface in the RM.</description> <name>yarn.resourcemanager.address</name> <value>h1-2:18040</value> </property> <property> <description>The address of the scheduler interface.</description> <name>yarn.resourcemanager.scheduler.address</name> <value>h1-2:18030</value> </property> <property> <description>The address of the RM web application.</description> <name>yarn.resourcemanager.webapp.address</name> <value>h1-2:18088</value> </property> <property> <description>The address of the resource tracker interface.</description> <name>yarn.resourcemanager.resource-tracker.address</name> <value>h1-2:8025</value> </property> </configuration>
h1-3 h1-4 h1-5
$ cd hadoop_home_dir $ ./bin/hdfs namenode -format格式化hdfs。格式化后会在namenode节点和slaves节点上建立对应的目录(/home/xc/dfs)
$ cd hadoop_home_dir $ ./sbin/start-all.sh
$ cd hadoop_home_dir $ ./bin/hdfs dfs -put <src> <dst> $ ./bin/hadoop jar ./share/hadoop/mapreduce/hadoop-mapreduce-examples-2.1.0-beta.jar wordcount