zoukankan      html  css  js  c++  java
  • hadoop配置(5) --启动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文件 

    1. mv ./etc/hadoop/mapred-site.xml.template ./etc/hadoop/mapred-site.xml

    1. <configuration>
    2.        <property>
    3.             <name>mapreduce.framework.name</name>
    4.             <value>yarn</value>
    5.        </property>
    6. </configuration>

    修改配置文件 yarn-site.xml


    1. <configuration>
    2.        <property>
    3.             <name>yarn.nodemanager.aux-services</name>
    4.             <value>mapreduce_shuffle</value>
    5.            </property>
    6. </configuration>


    启动yarn(需要先执行过 ./sbin/start-dfs.sh)


    1. ./sbin/start-yarn.sh
    检查:

    启动 YARN 之后,运行实例的方法还是一样的,仅仅是资源管理方式、任务调度不同。

    观察日志信息可以发现,不启用 YARN 时,是 “mapred.LocalJobRunner” 在跑任务,启用 YARN 之后,是 “mapred.YARNRunner” 在跑任务。启动 YARN 有个好处是可以通过 Web 界面查看任务的运行情况:http://localhost:8088/cluster






    hadoop@Athena:/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

    hadoop@Athena:/usr/local/hadoop$ ./sbin/start-yarn..sh 

    -su: ./sbin/start-yarn..sh: No such file or directory

    hadoop@Athena:/usr/local/hadoop$ ./sbin/start-yarn. 

    start-yarn.cmd  start-yarn.sh   

    hadoop@Athena:/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

    hadoop@Athena:/usr/local/hadoop$ jps

    16896 DataNode

    17395 NodeManager

    17109 SecondaryNameNode

    16774 NameNode

    17271 ResourceManager

    17432 Jps

    hadoop@Athena:/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

    hadoop@Athena:/usr/local/hadoop$ ./bin/hadoop jar ./share/hadoop/mapreduce/hadoop-mapreduce-examples-2.7.2.jar wordcount input/core-site.xml output/RESULT





    hadoop fs -lsr /查看所有文件和子目录,

    hadoop fs -put example.txt.

    注意上面的这个命令最后一个参数是句点(.)。这意味着我们把文件放入了默认的工作目录。该命令等价于:


    hadoop fs -put example.txt /user/chuck





  • 相关阅读:
    MySQL 基础 查询
    Mysql+keepalived双主
    Kubernetes(二)K8S基础架构
    Kubernetes(一)K8S入门
    Docker (五) 利用Dockerfile创建Nginx镜像
    Docker (四) 使用Dockerfile的方式构建镜像
    Docker (三) 使用commit创建Docker镜像
    Docker (二) Docker网络配置
    Ansible (四) 角色Roles
    Docker (一) Docker入门
  • 原文地址:https://www.cnblogs.com/iathena/p/5615739.html
Copyright © 2011-2022 走看看