文档章节

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
博文 156
码字总数 3099
作品 0
昆山
程序员
私信 提问
Hadoop 2.5.0编译到Apache Hadoop Common失败

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

尧雪
04/19
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
Bluemix中的Apache Spark数据分析服务入门

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

微wx笑
2016/05/22
0
0
hadoop2.7环境的编译安装

0.环境说明 编译所用的操作系统为: [root@host11 hadoop-2.7.1-src]# cat /etc/redhat-release CentOS release 6.5 (Final) hadoop的版本为2.7.1 1.安装依赖软件包 yum install svn autoconf......

openthings
2015/12/17
110
2
Spark1.0.0 应用程序部署工具spark-submit

问题导读: 1、Spar的应用程序部署工具都提供哪些功能? 2、Spar的应用程序部署工具有哪些? 3、什么是spark-submit? 随着Spark的应用越来越广泛,对支持多资源管理器应用程序部署工具的需求...

Zero零_度
2016/08/23
10
0

没有更多内容

加载失败,请刷新页面

加载更多

聊聊我怎么系统学习Linux技能并快速提高的

聊聊我怎么系统学习Linux技能并快速提高的 随着电子信息科技时代的发展,学会使用计算机在我们的生活中成为了必不可少的一项技能。而作为计算机中的三大操作系统之一的Linux更是饱受计算机爱...

linuxCool
9分钟前
1
0
Android/Java 获取一个byte[]的真实编码,用于解决乱码问题

来源地址:https://blog.csdn.net/qq_31384551/article/details/81627840 一个byte数组,byte[] buf,是由一个字符串转换来的,如何判断字符串使用的是什么编码? Mozilla的一个组件提供了相应...

她叫我小渝
18分钟前
0
0
使用spring-retry实现重试机制

我们经常会遇到一些场景,需要重试当前的操作,比如:文件上传失败,重新上传;微信accesstoken获取失败,重新获取等等的场景问题。那么今天就说一种可以实现此种机制的工具包:spring-retr...

哥本哈根的小哥
20分钟前
0
0
kubernetes notes

Error from server (ServerTimeout): error when creating "mysql.yaml": No API token found for service account "default", retry after the token is automatically created and added t......

kut
41分钟前
2
0
代理模式---静态代理

package com.atguigu.java; //接口的应用:代理模式---静态代理。 public class ProxyTest { public static void main(String[] args) { NetWork work = new RealServer(); ProxyServer pro......

architect刘源源
56分钟前
2
1

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部