1.配置文件:
(1)hadoop-env.sh,添加JAVA_HOME
export JAVA_HOME=/home/qian/app/jdk1.8.0_171
(2)core-site.xml,添加参数
<configuration> <property> <name>fs.defaultFS</name> <value>hdfs://192.168.1.143:8020</value> </property> <property> <name>hadoop.tmp.dir</name> <value>/home/qian/app/tmp</value> </property> </configuration>
(3)hdfs-site.xml,添加参数
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
(4)mapred-site.xml,添加参数
<configuration> <property> <name>mapreduce.framework.name</name> <value>yarn</value> </property> </configuration>
(5)slaves ,修改ip
192.168.1.143
(6)yarn-site.xml ,添加参数
<configuration> <!-- Site specific YARN configuration properties --> <property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value> </property> <property> <name>yarn.resourcemanager.hostname</name> <value>192.168.1.143</value> </property> </configuration>
2.运行hadoop以及yarm:
(1)hadoop脚本:
start-dfs.sh
(2)yarm脚本:
start-yarn.sh
(3)查看运行情况:
jps
如图:
hdfs
yarm
(4)测试yarm:
hadoop jar /home/qian/app/hadoop-2.6.0-cdh5.7.0/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.6.0-cdh5.7.0.jar pi 2 3
以上就是搭建hadoop环境。