热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

HadoopRPC源码阅读交互协议

Hadoop版本Hadoop2.6RPC主要分为3个部分:(1)交互协议(2)客户端(3

Hadoop版本Hadoop2.6

RPC主要分为3个部分:(1)交互协议(2)客户端 (3)服务端

(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



推荐阅读
author-avatar
小三coolboy958_818
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有