在Hadoop3中提交任务到YARN中执行所需配置
假设你的hadoop伪集群环境已经正常配置并启动,现在准备提交job到YARN中执行,
hadoop3中与以往版本有些不同,
- 1:配置mapred-site.xml
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<property>
<name>yarn.app.mapreduce.am.env</name>
<value>HADOOP_MAPRED_HOME=/opt/programs/hadoop-3.2.2</value>
</property>
<property>
<name>mapreduce.map.env</name>
<value>HADOOP_MAPRED_HOME=/opt/programs/hadoop-3.2.2</value>
</property>
<property>
<name>mapreduce.reduce.env</name>
<value>HADOOP_MAPRED_HOME=/opt/programs/hadoop-3.2.2</value>
</property>
HADOOP_MAPRED_HOME其实就是hadoop的安装目录,但是在hadoop3中需要单独的配置。
- 2:配置yarn-zite.xml
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.nodemanager.aux-services.mapreduce_shuffle.class</name>
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
</property>
配置上以上两点,就可以提交job执行了,以hadoop提供的sample为例,执行一个计算pi的任务
cd ${HADOOP_HOME}/share/hadoop/mapreduce
hadoop jar hadoop-mapreduce-examples-3.2.2.jar pi 2 3
网友评论