Hadoop RPC protocol description--转
原文地址:https://spotify.github.io/snakebite/hadoop_rpc.html
Snakebite currently implements the following protocol in snakebite.channel.SocketRpcChannel to communicate with the NameNode.
Connection
The Hadoop RPC protocol works as described below. On connection, headers are sent to setup a session. After that, multiple requests can be sent within the session.
| Function | Type | Default |
|---|---|---|
| Header | bytes | “hrpc” |
| Version | uint8 | 7 |
| Auth method | uint8 | 80 (Auth method SIMPLE) |
| Serialization type | uint8 | 0 (protobuf) |
| IpcConnectionContextProto length | uint32 | |
| IpcConnectionContextProto | bytes |
Sending messages
When sending a message, the following is sent to the sever:
| Function | Type |
|---|---|
| Length of the next two parts | uint32 |
| RpcPayloadHeaderProto length | varint |
| RpcPayloadHeaderProto | protobuf serialized message |
| HadoopRpcRequestProto length | varint |
| HadoopRpcRequestProto | protobuf serialized message |
varint is a Protocol Buffer variable int.
Note
The Java protobuf implementation uses writeToDelimited to prepend the message with their lenght, but the python implementation doesn’t implement such a method (yet).
Next to an rpcKind (snakebites default is RPC_PROTOCOL_BUFFER), an rpcOp (snakebites default isRPC_FINAL_PAYLOAD), the RpcPayloadHeaderProto message defines a callId that is added in the RPC response (described below).
The HadoopRpcRequestProto contains a methodName field that defines what server method is called and a has a property request that contains the serialized actual request message.
Receiving messages
After a message is sent, the response can be read in the following way:
| Function | Type |
|---|---|
| Length of the RpcResponseHeaderProto | varint |
| RpcResponseHeaderProto | bytes |
| Length of the RPC response | uint32 |
| Serialized RPC response | bytes |
The RpcResponseHeaderProto contains the callId of the request and a status field. The status can beSUCCESS, ERROR or FAILURE. In case SUCCESS the rest of response is a complete protobuf response.
In case of ERROR, the response looks like follows:
| Function | Type |
|---|---|
| Length of the RpcResponseHeaderProto | varint |
| RpcResponseHeaderProto | bytes |
| Length of the RPC response | uint32 |
| Length of the Exeption class name | uint32 |
| Exception class name | utf-8 string |
| Length of the stack trace | uint32 |
| Stack trace | utf-8 string |
Hadoop RPC protocol description--转的更多相关文章
- Hadoop基于Protocol Buffer的RPC实现代码分析-Server端
http://yanbohappy.sinaapp.com/?p=110 最新版本的Hadoop代码中已经默认了Protocol buffer(以下简称PB,http://code.google.co ...
- Hadoop基于Protocol Buffer的RPC实现代码分析-Server端--转载
原文地址:http://yanbohappy.sinaapp.com/?p=110 最新版本的Hadoop代码中已经默认了Protocol buffer(以下简称PB,http://code.goog ...
- Hadoop学习笔记—3.Hadoop RPC机制的使用
一.RPC基础概念 1.1 RPC的基础概念 RPC,即Remote Procdure Call,中文名:远程过程调用: (1)它允许一台计算机程序远程调用另外一台计算机的子程序,而不用去关心底层的网 ...
- Hadoop RPC机制的使用
一.RPC基础概念 1.1 RPC的基础概念 RPC,即Remote Procdure Call,中文名:远程过程调用: (1)它允许一台计算机程序远程调用另外一台计算机的子程序,而不用去关心底层的网 ...
- 【Hadoop代码笔记】通过JobClient对Jobtracker的调用详细了解Hadoop RPC
Hadoop的各个服务间,客户端和服务间的交互采用RPC方式.关于这种机制介绍的资源很多,也不难理解,这里不做背景介绍.只是尝试从Jobclient向JobTracker提交作业这个最简单的客户端服务 ...
- Hadoop RPC源码阅读-交互协议
Hadoop版本Hadoop2.6 RPC主要分为3个部分:(1)交互协议(2)客户端 (3)服务端 (1)交互协议 协议:把某些接口和接口中的方法称为协议,客户端和服务端只要实现这些接口中的方法就可 ...
- 每天收获一点点------Hadoop RPC机制的使用
一.RPC基础概念 1.1 RPC的基础概念 RPC,即Remote Procdure Call,中文名:远程过程调用: (1)它允许一台计算机程序远程调用另外一台计算机的子程序,而不用去关心底层的网 ...
- Hadoop RPC简单例子
jdk中已经提供了一个RPC框架-RMI,但是该PRC框架过于重量级并且可控之处比较少,所以Hadoop RPC实现了自定义的PRC框架. 同其他RPC框架一样,Hadoop RPC分为四个部分: ( ...
- Hadoop RPC源码分析
Hadoop RPC源码分析 上一篇文章http://www.cnblogs.com/dycg/p/rpc.html 讲了Hadoop RPC的使用方法,这一次我们从demo中一层层进行分析. RPC ...
随机推荐
- 20155323 2016-2017-2 《Java程序设计》第一周学习总结
20155323 2016-2017-2 <Java程序设计>第一周学习总结 1.浏览教材,根据自己的理解每章提出一个问题 第一章:既然JDK本身附有一个JRE,那么JRE和JDK的区别在 ...
- 对Linux命令od -tc -tx1的C语言程序实现myod-优化版
导语 自编od C语言实现版名为myod 上个星期有一个初代版,链接- myod原版 这星期的课上要求实现myod-系统调用版本,要求如下 1 参考教材第十章内容 2 用Linux IO相关系统调用编 ...
- 20155328 2016-2017-2 《Java程序设计》 课程总结
20155328 2016-2017-2 <Java程序设计> 课程总结 目录 一.每周作业链接汇总 二.实验报告链接汇总 三.代码托管链接 四.课堂项目实践 五.课程收获与不足 六.问卷 ...
- treegrid -表格树异步加载
问题: 机构维护时,前端框架用的是easyui,如果同步全加载会出现页面延迟严重,影响用户体验 解决: 机构逐层加载,点击后加载 逐层加载会出现一个问题:子节点只有点击后才能加载子集 所以开始为叶子节 ...
- html模板 练习(仿照抽屉网)
1.页面布局 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UT ...
- Yii2 模块module笔记
包含内容: 使用GII新建module 建立子模块 在其他控制器中调用模块的操作(action) 1. 使用Gii工具新建module 注意模块的路径,我们没有写backend\modules\Art ...
- charles录制https请求
之前一直用windows系统,抓包什么的都是用的fiddler或者wireshark,操作比较简单,扩展性也比较强,现在因为工作原因换了mac,在网上一直没有找到fiddler的mac版本,就只能切换 ...
- 高能福利 |"荐"者有份,有"福"同享
WeTest 导读 越来越多的开发者加入WeTest大家庭了,感谢大家一直以来的支持,WeTest又有新一步“大福利”赠送了! 即日起,参加WeTest用户推荐有礼活动,推荐者和被推荐者皆可获得福利. ...
- Eclipse各个版本
Eclipse最初是由IBM公司开发的替代商业软件Visual Age for Java的下一代IDE开发环境,2001年11月贡献给开源社区,现在它由非营利软件供应商联盟Eclipse基金会. Ec ...
- 安装文件报错error while loading shared libraries: libssl.so.6
http://www.openssl.org/source/ 这里下载http://www.openssl.org/source/openssl-1.0.0r.tar.gz 安装命令为:tar -z ...