hadoop配置 --启动YARN
Posted iAthena
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了hadoop配置 --启动YARN相关的知识,希望对你有一定的参考价值。
新版的 Hadoop 使用了新的 MapReduce 框架(MapReduce V2,也称为 YARN,Yet Another Resource Negotiator)。
YARN 是从 MapReduce 中分离出来的,负责资源管理与任务调度。YARN 运行于 MapReduce 之上,提供了高可用性、高扩展性。
上述通过 ./sbin/start-dfs.sh
启动 Hadoop,仅仅是启动了 MapReduce 环境,我们可以启动 YARN ,让 YARN 来负责资源管理与任务调度。
配置 mapr-site.xml文件
mv ./etc/hadoop/mapred-site.xml.template ./etc/hadoop/mapred-site.xml
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
修改配置文件 yarn-site.xml:
<configuration>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
</configuration>
启动yarn(需要先执行过 ./sbin/start-dfs.sh
)
./sbin/start-yarn.sh
启动 YARN 之后,运行实例的方法还是一样的,仅仅是资源管理方式、任务调度不同。
观察日志信息可以发现,不启用 YARN 时,是 “mapred.LocalJobRunner” 在跑任务,启用 YARN 之后,是 “mapred.YARNRunner” 在跑任务。启动 YARN 有个好处是可以通过 Web 界面查看任务的运行情况:http://localhost:8088/cluster
[email protected]:/usr/local/hadoop$ ./sbin/start-dfs.sh
16/06/22 20:28:42 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Starting namenodes on [localhost]
localhost: starting namenode, logging to /usr/local/hadoop/logs/hadoop-hadoop-namenode-Athena.out
localhost: starting datanode, logging to /usr/local/hadoop/logs/hadoop-hadoop-datanode-Athena.out
Starting secondary namenodes [0.0.0.0]
0.0.0.0: starting secondarynamenode, logging to /usr/local/hadoop/logs/hadoop-hadoop-secondarynamenode-Athena.out
16/06/22 20:29:05 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
[email protected]:/usr/local/hadoop$ ./sbin/start-yarn..sh
-su: ./sbin/start-yarn..sh: No such file or directory
[email protected]:/usr/local/hadoop$ ./sbin/start-yarn.
start-yarn.cmd start-yarn.sh
[email protected]:/usr/local/hadoop$ ./sbin/start-yarn.sh
starting yarn daemons
starting resourcemanager, logging to /usr/local/hadoop/logs/yarn-hadoop-resourcemanager-Athena.out
localhost: starting nodemanager, logging to /usr/local/hadoop/logs/yarn-hadoop-nodemanager-Athena.out
[email protected]:/usr/local/hadoop$ jps
16896 DataNode
17395 NodeManager
17109 SecondaryNameNode
16774 NameNode
17271 ResourceManager
17432 Jps
[email protected]:/usr/local/hadoop$ ./bin/hdfs dfs -rm -r output
16/06/22 20:29:46 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
16/06/22 20:29:47 INFO fs.TrashPolicyDefault: Namenode trash configuration: Deletion interval = 0 minutes, Emptier interval = 0 minutes.
Deleted output
[email protected]:/usr/local/hadoop$ ./bin/hadoop jar ./share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.2.jar wordcount input/core-site.xml output/RESULT
!--more-->
以上是关于hadoop配置 --启动YARN的主要内容,如果未能解决你的问题,请参考以下文章