文档章节

hadoop应用程序实例distributedshell

mskk
 mskk
发布于 2017/05/04 21:19
字数 1018
阅读 6
收藏 0

本文介绍YARN自带的一个非常简单的应用程序实例—distributedshell的使用方法。它可以看做YARN编程中的“hello world”,主要功能是并行执行用户提供的shell命令或者shell脚本。

 

(1)运行参数介绍

DistributedShell的基本运行参数如下:

(2)运行方法

DistributedShell的运行方法如下:

在YARN安装目录下,执行以下命令:

bin/hadoop jar\

share/hadoop/yarn/hadoop-yarn-applications-distributedshell-2.0.0-cdh4.1.1.jar\

org.apache.hadoop.yarn.applications.distributedshell.Client\

–jar share/hadoop/yarn/hadoop-yarn-applications-distributedshell-2.0.0-cdh4.1.1.jar\

–shell_command ls\

–shell_script ignore.sh\

–num_containers 10\

–container_memory 350\

–master_memory 350\

–priority 10

需要注意的是,在hadoop-2.0.3-alpha(不包括该版本)和CDH 4.1.2版本(包括该版本)之前,DistributedShell存在BUG,具体如下:

1)    必须使用–shell_command参数

2)    当只有shell_command参数而没有shell_script参数时,在分布式模式下(伪分布式下可以)不能执行成功,具体说明和修复方法见:https://issues.apache.org/jira/browse/YARN-253,一直临时的解决方案是同时设置shell_command和shell_script两个参数,像上面给出的这个实例一样。

在这个实例中,ignore.sh中的内容就是“ls”

3)    内存设置一定要正确,不然会出现以下提示的错误:

Container [pid=4424,containerID=container_1359629844156_0004_01_000001] is running beyond virtual memory limits. Current usage: 90.1mb of 128.0mb physical memory used; 593.0mb of 268.8mb virtual memory used. Killing container.

【附】DistributedShell运行日志:

13/02/01 13:43:11 INFO distributedshell.Client: Initializing Client

13/02/01 13:43:11 INFO distributedshell.Client: Starting Client

13/02/01 13:43:11 INFO distributedshell.Client: Connecting to ResourceManager at c2-23/10.1.1.98:8032

13/02/01 13:43:12 INFO distributedshell.Client: Got Cluster metric info from ASM, numNodeManagers=3

13/02/01 13:43:12 INFO distributedshell.Client: Got Cluster node info from ASM

13/02/01 13:43:12 INFO distributedshell.Client: Got node report from ASM for, nodeId=c2-23:36594, nodeAddressc2-23:8042, nodeRackName/default-rack, nodeNumContainers0, nodeHealthStatusis_node_healthy: true, health_report: “”, last_health_report_time: 1359697377337,

13/02/01 13:43:12 INFO distributedshell.Client: Got node report from ASM for, nodeId=c2-25:41070, nodeAddressc2-25:8042, nodeRackName/default-rack, nodeNumContainers0, nodeHealthStatusis_node_healthy: true, health_report: “”, last_health_report_time: 1359697367180,

13/02/01 13:43:12 INFO distributedshell.Client: Got node report from ASM for, nodeId=c2-24:48383, nodeAddressc2-24:8042, nodeRackName/default-rack, nodeNumContainers0, nodeHealthStatusis_node_healthy: true, health_report: “”, last_health_report_time: 1359699033102,

13/02/01 13:43:12 INFO distributedshell.Client: Queue info, queueName=default, queueCurrentCapacity=0.0, queueMaxCapacity=1.0, queueApplicationCount=0, queueChildQueueCount=0

13/02/01 13:43:12 INFO distributedshell.Client: User ACL Info for Queue, queueName=default, userAcl=SUBMIT_APPLICATIONS

13/02/01 13:43:12 INFO distributedshell.Client: User ACL Info for Queue, queueName=default, userAcl=ADMINISTER_QUEUE

13/02/01 13:43:12 INFO distributedshell.Client: Got new application id=application_1359695803957_0003

13/02/01 13:43:12 INFO distributedshell.Client: Min mem capabililty of resources in this cluster 128

13/02/01 13:43:12 INFO distributedshell.Client: Max mem capabililty of resources in this cluster 10240

13/02/01 13:43:12 INFO distributedshell.Client: Setting up application submission context for ASM

13/02/01 13:43:12 INFO distributedshell.Client: Copy App Master jar from local filesystem and add to local environment

13/02/01 13:43:13 INFO distributedshell.Client: Set the environment for the application master

13/02/01 13:43:13 INFO distributedshell.Client: Trying to generate classpath for app master from current thread’s classpath

13/02/01 13:43:13 INFO distributedshell.Client: Readable bytes from stream=9006

13/02/01 13:43:13 INFO distributedshell.Client: Setting up app master command

13/02/01 13:43:13 INFO distributedshell.Client: Completed setting up app master command ${JAVA_HOME}/bin/java -Xmx350m org.apache.hadoop.yarn.applications.distributedshell.ApplicationMaster –container_memory 350 –num_containers 10 –priority 0 –shell_command ls 1>/AppMaster.stdout 2>/AppMaster.stderr

13/02/01 13:43:13 INFO distributedshell.Client: Submitting application to ASM

13/02/01 13:43:14 INFO distributedshell.Client: Got application report from ASM for, appId=3, clientToken=null, appDiagnostics=, appMasterHost=N/A, appQueue=default, appMasterRpcPort=0, appStartTime=1359697393467, yarnAppState=ACCEPTED, distributedFinalState=UNDEFINED, appTrackingUrl=c2-23:8088/proxy/application_1359695803957_0003/, appUser=rmss

13/02/01 13:43:15 INFO distributedshell.Client: Got application report from ASM for, appId=3, clientToken=null, appDiagnostics=, appMasterHost=, appQueue=default, appMasterRpcPort=0, appStartTime=1359697393467, yarnAppState=RUNNING, distributedFinalState=UNDEFINED, appTrackingUrl=, appUser=rmss

13/02/01 13:43:16 INFO distributedshell.Client: Got application report from ASM for, appId=3, clientToken=null, appDiagnostics=, appMasterHost=, appQueue=default, appMasterRpcPort=0, appStartTime=1359697393467, yarnAppState=RUNNING, distributedFinalState=UNDEFINED, appTrackingUrl=, appUser=rmss

13/02/01 13:43:17 INFO distributedshell.Client: Got application report from ASM for, appId=3, clientToken=null, appDiagnostics=, appMasterHost=, appQueue=default, appMasterRpcPort=0, appStartTime=1359697393467, yarnAppState=RUNNING, distributedFinalState=UNDEFINED, appTrackingUrl=, appUser=rmss

13/02/01 13:43:18 INFO distributedshell.Client: Got application report from ASM for, appId=3, clientToken=null, appDiagnostics=, appMasterHost=, appQueue=default, appMasterRpcPort=0, appStartTime=1359697393467, yarnAppState=RUNNING, distributedFinalState=UNDEFINED, appTrackingUrl=, appUser=rmss

13/02/01 13:43:19 INFO distributedshell.Client: Got application report from ASM for, appId=3, clientToken=null, appDiagnostics=, appMasterHost=, appQueue=default, appMasterRpcPort=0, appStartTime=1359697393467, yarnAppState=FINISHED, distributedFinalState=SUCCEEDED, appTrackingUrl=, appUser=rmss

13/02/01 13:43:19 INFO distributedshell.Client: Application has completed successfully. Breaking monitoring loop

13/02/01 13:43:19 INFO distributedshell.Client: Application completed successfully

原创文章,转载请注明: 转载自董的博客

本文链接地址: http://dongxicheng.org/mapreduce-nextgen/how-to-run-distributedshell/

作者:Dong,作者介绍:http://dongxicheng.org/about/

本博客的文章集合:http://dongxicheng.org/recommend/

本文转载自:http://gaylord.iteye.com/blog/2083668

共有 人打赏支持
mskk
粉丝 3
博文 151
码字总数 3099
作品 0
宝山
程序员
Hadoop 2.5.0编译到Apache Hadoop Common失败

[INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] Apache Hadoop Main ................................. SUCCES......

尧雪
04/19
0
0
Bluemix中的Apache Spark数据分析服务入门

Spark是一个基于内存计算的开源的集群计算系统,目的是让数据分析更加快速。Spark非常小巧玲珑,由加州伯克利大学AMP实验室的Matei为主的小团队所开发。使用的语言是Scala,项目的core部分的...

微wx笑
2016/05/22
0
0
编译hadoop-2.2.0源码,RHEL6.3x64

编译环境: OS: RHEL6.3.x86_64 Kernel:2.6.32-358.el6.x86_64 JDK: 1.6.035 x8664 编译前准备: 1.安装依赖的rpm包 yum -y install lzo-devel zlib-devel gcc autoconf automake libtool op......

徐霞客
2013/12/28
0
0
Amazon EMR(Elastic MapReduce):亚马逊Hadoop托管服务运行架构&Hadoop云服务之战:微软vs.亚马逊

http://s3tools.org/s3cmd Amazon Elastic MapReduce (Amazon EMR)简介 Amazon Elastic MapReduce (Amazon EMR) 是一种 Web 服务,提升企业、研究人员、数据分析师和开发人员轻松、经济高效掌...

长征2号
2017/08/30
0
0
大数据经典学习路线(及供参考)之 一

1.Linux基础和分布式集群技术 学完此阶段可掌握的核心能力: 熟练使用Linux,熟练安装Linux上的软件,了解熟悉负载均衡、高可靠等集群相关概念,搭建互联网高并发、高可靠的服务架构; 学完此...

柯西带你学编程
05/22
0
0

没有更多内容

加载失败,请刷新页面

加载更多

【解惑】领略Java内部类的“内部”

内部类有两种情况: (1) 在类中定义一个类(私有内部类,静态内部类) (2) 在方法中定义一个类(局部内部类,匿名内部类) 1、私有内部类 —— 在方法之间定义的内部类,非静态 我们首先看看类中...

偶尔诗文
34分钟前
1
0
sqlserver 2008 r2 直接下载地址(百度云)

之前下载的sqlserver2008发现不能附加,就卸载了,重新找到了sqlserver2008R2的百度云资源 卸载sqlserver2008还是有点麻烦,不过就是需要删除注册表中的信息 自己来回卸载了3次终于重装sqlse...

dillonxiao
今天
1
0
[Java]JVM调优总结 -Xms -Xmx -Xmn -Xss

JVM调优总结 -Xms -Xmx -Xmn -Xss 博客分类: Java General JVM应用服务器电信CMS算法 堆大小设置 JVM 中最大堆大小有三方面限制:相关操作系统的数据模型(32-bt还是64-bit)限制;系统的可...

morpheusWB
今天
2
0
C++ std::function 和 std::bind

C++11提供了std::function和std::bind两个工具,用于引用可调用对象。这些可调用对象包括 普通函数,Lambda表达式,类的静态成员函数,非静态成员函数以及仿函数等。引用可调用对象,可以用于...

yepanl
今天
4
0
python:可迭代对象的索引

关于 python的range的用法: 注意是[ 开始,结束)的半开区间,不包括结束 http://www.runoob.com/python/python-func-range.html import collectionsfrom collections import Iterable字符串......

Oh_really
今天
3
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部