原文地址: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 beSUCCESSERROR 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--转的更多相关文章

  1. Hadoop基于Protocol Buffer的RPC实现代码分析-Server端

    http://yanbohappy.sinaapp.com/?p=110 最新版本的Hadoop代码中已经默认了Protocol buffer(以下简称PB,http://code.google.co ...

  2. Hadoop基于Protocol Buffer的RPC实现代码分析-Server端--转载

    原文地址:http://yanbohappy.sinaapp.com/?p=110 最新版本的Hadoop代码中已经默认了Protocol buffer(以下简称PB,http://code.goog ...

  3. Hadoop学习笔记—3.Hadoop RPC机制的使用

    一.RPC基础概念 1.1 RPC的基础概念 RPC,即Remote Procdure Call,中文名:远程过程调用: (1)它允许一台计算机程序远程调用另外一台计算机的子程序,而不用去关心底层的网 ...

  4. Hadoop RPC机制的使用

    一.RPC基础概念 1.1 RPC的基础概念 RPC,即Remote Procdure Call,中文名:远程过程调用: (1)它允许一台计算机程序远程调用另外一台计算机的子程序,而不用去关心底层的网 ...

  5. 【Hadoop代码笔记】通过JobClient对Jobtracker的调用详细了解Hadoop RPC

    Hadoop的各个服务间,客户端和服务间的交互采用RPC方式.关于这种机制介绍的资源很多,也不难理解,这里不做背景介绍.只是尝试从Jobclient向JobTracker提交作业这个最简单的客户端服务 ...

  6. Hadoop RPC源码阅读-交互协议

    Hadoop版本Hadoop2.6 RPC主要分为3个部分:(1)交互协议(2)客户端 (3)服务端 (1)交互协议 协议:把某些接口和接口中的方法称为协议,客户端和服务端只要实现这些接口中的方法就可 ...

  7. 每天收获一点点------Hadoop RPC机制的使用

    一.RPC基础概念 1.1 RPC的基础概念 RPC,即Remote Procdure Call,中文名:远程过程调用: (1)它允许一台计算机程序远程调用另外一台计算机的子程序,而不用去关心底层的网 ...

  8. Hadoop RPC简单例子

    jdk中已经提供了一个RPC框架-RMI,但是该PRC框架过于重量级并且可控之处比较少,所以Hadoop RPC实现了自定义的PRC框架. 同其他RPC框架一样,Hadoop RPC分为四个部分: ( ...

  9. Hadoop RPC源码分析

    Hadoop RPC源码分析 上一篇文章http://www.cnblogs.com/dycg/p/rpc.html 讲了Hadoop RPC的使用方法,这一次我们从demo中一层层进行分析. RPC ...

随机推荐

  1. 20155307 2017-2018-2 《Java程序设计》第2周学习总结

    20155307 2017-2018-2 <Java程序设计>第2周学习总结 教材学习内容总结 整数:short(2 byte).int(4 byte).long(8 byte) 字节(b ...

  2. 2017-2018-1 20155308《信息安全技术》实验二——Windows口令破解

    2017-2018-1 20155308<信息安全技术>实验二--Windows口令破解 实验原理 口令破解主要有两种方法:字典破解和暴力破解. 字典破解是指通过破解者对管理员的了解,猜测 ...

  3. #20155327 2016-2017-2 《Java程序设计》第三周学习总结

    20155327 2016-2017-2 <Java程序设计>第三周学习总结 教材学习内容总结 一.三种重要的数字表示 无符号:编码基于传统的二进制表示法,表示大于或者等于零的数字. 补码 ...

  4. libuv源码分析

    项目开发过程中经常使用了基于libuv库封装的库接口来实现异步处理,一直没仔细研究过这些接口的内部如何实现,因此也就没有掌握它的设计思想.今天花了点时间研究了其事件循环内部的一些过程,总算有了一些理解 ...

  5. tableView--iOS11适配和iPhoneX适配

    1.UIScrollView及其子类在IOS 11之前的版本UI显示完全正常,但是在IOS 11上面会显示奇葩的界面. (1)先看一下UITablevIew. 原本在VC里面的automaticall ...

  6. 【LG3234】[HNOI2014]抄卡组

    题面 题解 分三种情况: 若所有串都没有通配符,直接哈希比较即可. 若所有串都有通配符, 把无通配符的前缀 和 无通配符的后缀哈希后比较即可. 中间部分由于通配符的存在,一定可以使所有串匹配. 若部分 ...

  7. Wince 中访问WCF服务

    由于本文并非WinCE开发普及篇,所以一些WinCE开发和WCF开发的基础还请移步百度和谷歌寻找答案,然后结合本文开发出WinCE中如何访问WCF,谢谢. 开发环境 IDE:Visual Studio ...

  8. springmvc传参---LocalDateTime、Date等时间类型转换

    此处定义的dateConvert用来转换Date类型,如果是LocalDate.LocalDateTime类型,则将Date类型换成相应的类型即可,注意java8的日期类型需要用Formatter格式 ...

  9. Unity Lighting - Emissive Materials 自发光材质(九)

      Emissive Materials 自发光材质 Whilst Area Lights are not supported by Precomputed Realtime GI, similar ...

  10. Siki_Unity_3-8_Lua编程(未完)

    Unity 3-8 Lua编程 任务1&2&3:前言 课程内容: Lua从入门到掌握 为之后的xLua和其他热更新方案打下基础 任务4:Lua简介 Lua是轻量小巧的脚本语言--无需编 ...