当Samza ApplicationMaster启动时,它做以下的事情:

  1. 通过STREAMING_CONFIG环境变量从YARN获取配置信息(configuration)
  2. 在随机端口上 启动一个JMX server
  3. 实例化一个metrics registry和reporter来追踪计量信息
  4. 将AM向YARN的RM注册
  5. 使用每个stream的PartitionManager来获取总共的partition数量
  6. 从Samza的job configuration里获取总的container数量
  7. 将partition分给container(在Samza AM的dashboard里,称为Task Group)
  8. 为每个container向YARN发送一个ResourceRequest
  9. 每秒向YARN RM poll一次,检查allocated and released containers
SamzaAppMaster的实现
 
并不是提交AppMaster,只是向RM注册这个AppMaster。因为此时,AppMaster已经启动了。
1.在SamzaAppMasterLifecycle对象的onInit()方法中,使用amCient.registerApplicationMaster
2    val response = amClient.registerApplicationMaster (host , state.rpcPort, "%s:%d" format (host, state. trackingPort))
 
amClient对象的类:
 
org.apache.hadoop.yarn.client.api.async.AMRMClientAsync<T extends org.apache.hadoop.yarn.client.api.AMRMClient.ContainerRequest>

 

AMRMClientAsync handles communication with the ResourceManager and provides asynchronous updates on events such as container allocations and completions. It contains a thread that sends periodic heartbeats to the ResourceManager. It should be used by implementing a CallbackHandler:

 class MyCallbackHandler implements AMRMClientAsync.CallbackHandler {
public void onContainersAllocated(List<Container> containers) {
[run tasks on the containers]
} public void onContainersCompleted(List<ContainerStatus> statuses) {
[update progress, check whether app is done]
} public void onNodesUpdated(List<NodeReport> updated) {} public void onReboot() {}
}

The client's lifecycle should be managed similarly to the following:

 AMRMClientAsync asyncClient =
createAMRMClientAsync(appAttId, 1000, new MyCallbackhandler());
asyncClient.init(conf);
asyncClient.start();
RegisterApplicationMasterResponse response = asyncClient
.registerApplicationMaster(appMasterHostname, appMasterRpcPort,
appMasterTrackingUrl);
asyncClient.addContainerRequest(containerRequest);
[... wait for application to complete]
asyncClient.unregisterApplicationMaster(status, appMsg, trackingUrl);
asyncClient.stop();
这个类是用来做为一个Client和RM进行通信,并且注册一个用于回调的对象来处理container 的allocation和completion事件。它启动一个线程,周期性地发送hearbeat至ResourceManager

Samza的ApplicationMaster的更多相关文章

  1. Samza文档翻译 : Architecture

    http://samza.incubator.apache.org/learn/documentation/0.7.0/introduction/architecture.html Samza由三层组 ...

  2. Samza在YARN上的启动过程 =》 之二 submitApplication

    首先,来看怎么构造一个org.apache.hadoop.yarn.client.api.YarnClient class ClientHelper(conf: Configuration) exte ...

  3. Samza在YARN上的启动过程 =》 之一

    运行脚本,提交job 往YARN提交Samza job要使用run-job.sh这个脚本. samza-example/target/bin/run-job.sh  --config-factory= ...

  4. Samza/KafkaAnalysizing

    Apache Samza is a distributed stream processing framework. It uses Apache Kafka for messaging, and A ...

  5. Apache Samza - Reliable Stream Processing atop Apache Kafka and Hadoop YARN

    http://engineering.linkedin.com/data-streams/apache-samza-linkedins-real-time-stream-processing-fram ...

  6. 流式大数据处理的三种框架:Storm,Spark和Samza

    许多分布式计算系统都可以实时或接近实时地处理大数据流.本文将对三种Apache框架分别进行简单介绍,然后尝试快速.高度概述其异同. Apache Storm 在Storm中,先要设计一个用于实时计算的 ...

  7. [转载]流式大数据处理的三种框架:Storm,Spark和Samza

    许多分布式计算系统都可以实时或接近实时地处理大数据流.本文将对三种Apache框架分别进行简单介绍,然后尝试快速.高度概述其异同. Apache Storm 在Storm中,先要设计一个用于实时计算的 ...

  8. 如何设置Samza的metrics

    参考这个里边对API的调用 http://samza.incubator.apache.org/learn/documentation/0.7.0/container/metrics.html 参考这 ...

  9. Samza文档翻译 : Comparison Introduction

    http://samza.incubator.apache.org/learn/documentation/0.7.0/comparisons/introduction.html 这里有一些使得Sam ...

随机推荐

  1. SQL 的一个技巧

    遇到一个需求,项目是我接手二次开发的,之前的大神设计数据库,订单表中没有订单号,现在让我加上这个号,规则是订单创建日期加上自增的ID,ID需要补足5位,例:00002,00124,01245这样.这个 ...

  2. 腾讯QQ群数据下载方法(7000万个qq群资料全泄漏)

    仔细读完一定能找到自己需要的东西 据新华网报道,国内知名安全漏洞监测平台乌云20日公布报告称,腾讯QQ群关系数据被泄露,网上可以轻易就能找到数据下载链接,根据这些数据,通过QQ号可以查询到备注姓名.年 ...

  3. 第四十四篇、iOS开发中git添加.gitignore文件

    .gitignore文件可以直接使用https://github.com/github/gitignore 1.在项目中设置忽略文件(1)将从github上荡下来的对应的.gitignore文件(Sw ...

  4. 重建Mac系统的文件打开方式

    /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Ver ...

  5. 关于IE8以上 不引人css 症状

    不知道各位有没有体验过 这样的状况  在同一个文件夹中 <!DOCTYPE html> <html> <head> <meta charset="u ...

  6. 【转】Linux网络编程入门

    (一)Linux网络编程--网络知识介绍 Linux网络编程--网络知识介绍客户端和服务端         网络程序和普通的程序有一个最大的区别是网络程序是由两个部分组成的--客户端和服务器端. 客户 ...

  7. class不想被复制的两个做法

    1,当一个class不想被复制的时候,可以将copy构造函数和copy assignment操作符声明为private.(只声明不定义,因此可以不指定函数参数) 2,或者,继承一个专门为了阻止copy ...

  8. 查看Aix系统配置命令

    prtconf#topas http://baike.baidu.com/link?url=QruEnlfCqyoqQ565LicyKxIGMQYSkVesj6j9GzHWwzpDOagXtuprhT ...

  9. DTCMS一些问题

    站点管理,主站和手机站同时绑定不同域名 手机站会报错,解决方法为 主站不绑定 手机站绑定 关键问题为:不能和主站域名相同 PC模版文件下的JS文件夹下的commen.js和手机模版下的JS文件夹下的b ...

  10. 10套免费的响应式布局 Bootstrap 模版

    1. Cardio Cardio是我最喜欢的一个轻量级模板.它几乎可以很少的修改的用于任何类型的业务. 2. Evento Evento 是一个事件引导广告模板的形状.它是设计精美和注意细节. 3. ...