1、 core-site.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://server01:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/usr/local/hadoop-2.5.0-cdh5.2.0/tmp</value>
</property>
<property>
<name>fs.trash.interval</name>
<value>2000</value>
</property>
</configuration>

2、hdfs-site.xml

1
2
3
4
5
6
7
8
9
10
	<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.permissions</name>
<value>false</value>
</property>
</configuration>

3、yarn-site.xml

1
2
3
4
5
6
7
8
9
10
	<configuration>
<property>
<name>yarn.resourcemanager.hostname</name>
<value>server01</value>
</property>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
</configuration>

4、mapred-site.xml

1
2
3
4
5
6
	<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>

5、slaves

1
server01

5、格式化hdfs文件系统

1
bin/hdfs namenode -format

6、启动

1
2
hadoop-daemon.sh start namenode/datanode
yarn-daemon.sh start resourcemanager/nodemanager

7、测试

1
hadoop jar hadoop-mapreduce-examples-2.4.0.jar wordcount /testdata /output