伪分布模式:
hosts
127.0.0.1 Cat11
env:
# Jdk
JAVA_HOME=/usr/java/jdk/jdk8
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
# Hadoop
HADOOP_HOME=/usr/java/hadoop/hadoop3
export HADOOP_HOME
PATH=$HADOOP_HOME/bin:$HADOOP/sbin:$PATH
export PATH
export HDFS_NAMENODE_USER="root"
export HDFS_DATANODE_USER="root"
export HDFS_SECONDARYNAMENODE_USER="root"
export YARN_RESOURCEMANAGER_USER="root"
export YARN_NODEMANAGER_USER="root"
hadoop-env.sh
export JAVA_HOME=/usr/java/jdk/jdk8
hdfs-site.xml
<!--数据块冗余度,默认3-->
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<!--是否开启HDFS的权限检查,默认:true-->
<!--
<property>
<name>dfs.permissions</name>
<value>false</value>
</property>
-->
core-site.xml
<!--NameNode的地址-->
<property>
<name>fs.defaultFS</name>
<value>hdfs://Cat11:9000</value>
</property>
<!--HDFS数据保存的目录,默认是Linux的tmp目录-->
<property>
<name>hadoop.tmp.dir</name>
<value>/usr/java/hadoop/hadoop3/tmp</value>
</property>
mapred-site.xml
<!--MR程序运行的容器是Yarn-->
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
yarn-site.xml
<!--ResourceManager的地址-->
<property>
<name>yarn.resourcemanager.hostname</name>
<value>Cat11</value>
</property>
<!--NodeManager运行MR任务的方式-->
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
格式化NameNode
hdfs namenode -format
name has been successfully formatted.(成功字段)
然后就能启动了!
start-all.sh
最后测试一下wordcount的时候报错了
hdfs dfs -put data /
hadoop jar $HADOOP_HOME/share/hadoop/mapreduce/hadoop-mapreduce-examples-3.*.jar wordcount /data /output/test
报错信息大概是这样
Please check whether your etc/hadoop/mapred-site.xml contains the below configuration:
<property>
<name>yarn.app.mapreduce.am.env</name>
<value>HADOOP_MAPRED_HOME=${full path of your hadoop distribution directory}</value>
</property>
<property>
<name>mapreduce.map.env</name>
<value>HADOOP_MAPRED_HOME=${full path of your hadoop distribution directory}</value>
</property>
<property>
<name>mapreduce.reduce.env</name>
<value>HADOOP_MAPRED_HOME=${full path of your hadoop distribution directory}</value>
</property>
再把Mapreduce的环境变量配一下
mapred-site.xml
<property>
<name>yarn.app.mapreduce.am.env</name>
<value>HADOOP_MAPRED_HOME=$HADOOP_HOME</value>
</property>
<property>
<name>mapreduce.map.env</name>
<value>HADOOP_MAPRED_HOME=$HADOOP_HOME</value>
</property>
<property>
<name>mapreduce.reduce.env</name>
<value>HADOOP_MAPRED_HOME=$HADOOP_HOME</value>
</property>
完成!