博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Hadoop RPC源码阅读-交互协议
阅读量:4324 次
发布时间:2019-06-06

本文共 2207 字,大约阅读时间需要 7 分钟。

Hadoop版本Hadoop2.6

RPC主要分为3个部分:(1)交互协议 

(1)交互协议

协议:把某些接口和接口中的方法称为协议,客户端和服务端只要实现这些接口中的方法就可以进行通信了

Hadoop RPC中VersionedProtocol是所有协议的父类,只定义了两个方法。

package org.apache.hadoop.ipc;import java.io.IOException;/** * Superclass of all protocols that use Hadoop RPC. * Subclasses of this interface are also supposed to have * a static final long versionID field. */public interface VersionedProtocol {    /**   * Return protocol version corresponding to protocol interface.   * @param protocol The classname of the protocol interface   * @param clientVersion The version of the protocol that the client speaks   * @return the version that the server will speak   * @throws IOException if any IO error occurs   */  public long getProtocolVersion(String protocol,                                 long clientVersion) throws IOException;  /**   * Return protocol version corresponding to protocol interface.   * @param protocol The classname of the protocol interface   * @param clientVersion The version of the protocol that the client speaks   * @param clientMethodsHash the hashcode of client protocol methods   * @return the server protocol signature containing its version and   *         a list of its supported methods   * @see ProtocolSignature#getProtocolSignature(VersionedProtocol, String,    *                long, int) for a default implementation   */  public ProtocolSignature getProtocolSignature(String protocol,                                  long clientVersion,                                 int clientMethodsHash) throws IOException;}

Hadoop RPC中的几个重要的协议

HDFS相关:

ClientDatanodeProtocol :一个客户端和datanode之间的协议接口,用于数据块恢复ClientProtocol :client与Namenode交互的接口,所有控制流的请求均在这里,如:创建文件、删除文件等;DatanodeProtocol : Datanode与Namenode交互的接口,如心跳、blockreport等;NamenodeProtocol :SecondaryNode与Namenode交互的接口。

MapReduce相关:

InterDatanodeProtocol :Datanode内部交互的接口,用来更新block的元数据;InnerTrackerProtocol :TaskTracker与JobTracker交互的接口,功能与DatanodeProtocol相似;//在hadoop2.6中找不到JobSubmissionProtocol :JobClient与JobTracker交互的接口,用来提交Job、获得Job等与Job相关的操作;//在hadoop2.6中找不到TaskUmbilicalProtocol :Task中子进程与母进程交互的接口,子进程即map、reduce等操作,母进程即TaskTracker,该接口可以回报子进程的运行状态(词汇扫盲: umbilical 脐带的, 关系亲密的) 。

 

转载于:https://www.cnblogs.com/arbitrary/p/5628697.html

你可能感兴趣的文章
ubuntu 16.04LTS
查看>>
javascript深入理解js闭包
查看>>
Java Bigdecimal使用
查看>>
SQL注入之绕过WAF和Filter
查看>>
jquery validate使用方法
查看>>
DataNode 工作机制
查看>>
windows系统下安装MySQL
查看>>
错误提示总结
查看>>
实验二+070+胡阳洋
查看>>
Linux IPC实践(3) --具名FIFO
查看>>
Qt之模拟时钟
查看>>
第一次接触安卓--记于2015.8.21
查看>>
(转)在分层架构下寻找java web漏洞
查看>>
mac下多线程实现处理
查看>>
C++ ifstream ofstream
查看>>
跟初学者学习IbatisNet第四篇
查看>>
seL4环境配置
查看>>
Git报错:insufficient permission for adding an object to repository database .git/objects
查看>>
ajax跨域,携带cookie
查看>>
BZOJ 1600: [Usaco2008 Oct]建造栅栏( dp )
查看>>