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 ...
随机推荐
- thinkphp5 开启多语言
一.配置点击打开链接1.开启语言包功能'lang_switch_on' => true,2.支持的语言列表'lang_list' => ['zh-cn','en-us'],二.语言定义(默 ...
- 接口文档神器Swagger(下篇)
本文来自网易云社区 作者:李哲 二.Swagger-springmvc原理解析 上面介绍了如何将springmvc和springboot与swagger结合,通过简单配置生成接口文档,以及介绍了swa ...
- tomcat7以上的版本,400BadRequest
出现此原因的解决办法其一,详情可见: https://www.cnblogs.com/dygrkf/p/9088370.html. 另一种解决方法,就是把url中不允许出现的字符编码,后台接收时再解码 ...
- PHP核心技术——魔术方法
魔术方法: 魔术方法是以两个下画线开头.具有特殊作用的一些方法,可以看做PHP的"语法糖". set和get方法: class Account{ private $user=1; ...
- css各种鼠标手型集合
比较齐全的鼠标手型css在国内的网站上是没搜到这么全的比如说哪个禁止的手型:鼠标往下移动即可看到效果: html代码如下: <h1>Cursors</h1> <div c ...
- ovs源码阅读--流表查询原理
背景 在ovs交换机中,报文的处理流程可以划分为一下三个步骤:协议解析,表项查找和动作执行,其中最耗时的步骤在于表项查找,往往一个流表中有数目巨大的表项,如何根据数据报文的信息快速的查找到对应的流表项 ...
- 团队项目选题报告(I know)
一.团队成员及分工 团队名称:I know 团队成员: 陈家权:选题报告word撰写 赖晓连:ppt制作,原型设计 雷晶:ppt制作,原型设计 林巧娜:原型设计,博客随笔撰写 庄加鑫:选题报告word ...
- SELECT - OVER 子句 (Transact-SQL)
标题:SELECT - OVER 子句 (Transact-SQL) 地址:https://docs.microsoft.com/zh-cn/sql/t-sql/queries/select-over ...
- Nodejs学习笔记(一)--- 操作Mysql数据库
对于一门语言的学习,我个人觉得最好的方式就是通过一个项目来展示,所以从基本的一些模块去了解是最好的方式对于Mysql怎么去链接数据库这个我是在网上找到的(其实一直想找官方文档的,发现没有它的踪迹,(后 ...
- (一)Tensorflow安装
主要包括下面两个指令: $ sudo apt-get install python-pip python-dev $ sudo pip install --upgrade https://storag ...