【如果觉得我的笔记写的好,您可以小额赞助我:支付宝 15202166392】
本文环境:
OS:CentOS 6.6
JDK:1.7.0_79
Hadoop:2.7.0
User:xavier
一、伪分布式Hadoop配置
[备注]
Hadoop位于:/home/xavier/下
Hadoop目录下建立:tmp,dfs/name,dfs/data目录
[/备注]
1.设置Hadoop环境变量:
1 #Set Hadoop Environment 2 export HADOOP_HOME="/home/xavier/Hadoop2" 3 export PATH="$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$PATH"
2.编辑etc/hadoop/hadoop-env.sh :
1 #Set Java Environment 2 export JAVA_HOME="/usr/java/jdk1.7.0_79"
3.编辑etc/hadoop/core-site.xml:
1 <configuration> 2 <property> 3 <name>fs.defaultFS</name> 4 <value>hdfs://localhost:9000</value> 5 </property> 6 <property> 7 <name>hadoop.tmp.dir</name> 8 <value>file:///home/xavier/Hadoop2/tmp</value> 9 </property> 10 </configuration>
4.编辑etc/hadoop/hdfs-site.xml:
1 <configuration> 2 <property> 3 <name>dfs.replication</name> 4 <value>1</value> 5 </property> 6 <property> 7 <name>dfs.namenode.name.dir</name> 8 <value>file:///home/xavier/Hadoop2/dfs/name</value> 9 </property> 10 <property> 11 <name>dfs.namenode.data.dir</name> 12 <value>file:///home/xavier/Hadoop2/dfs/data</value> 13 </property> 14 </configuration>
5.cp mapred-site.xml.template mapred-site.xml
6.编辑etc/hadoop/mapred-site.xml:
1 <configuration> 2 <property> 3 <name>mapreduce.framework.name</name> 4 <value>yarn</value> 5 </property> 6 </configuration>
7.编辑etc/hadoop/yarn-site.xml:
1 <configuration> 2 <property> 3 <name>yarn.nodemanager.aux-services</name> 4 <value>mapreduce_shuffle</value> 5 </property> 6 </configuration>
8.格式化namenode:
./hdfs namenode -format
9.启动dfs,yarn:
./start-dfs.sh
./start-yarn.sh
10.浏览器访问:(稍等一分钟,等电脑运行)
http://localhost:8088/
http://localhost:50070/
如果都能访问成功,看到Hadoop小象,应该就成功了!
时间: 2024-11-19 12:26:37