原文地址: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. debug 调试原理理解

    引言: 昨天,看了一篇文章,很受启发,记得之前听别的人远程调试过代码,觉得很神奇,在自己程序里打断点,连接远程服务器,开启调试后可以调用远程方法来看数据的输入和输出,不需要查找问题,重新部署,测试问题 ...

  2. maven 发布springboot项目

    1.把Spring Boot打包成JAR的形式,需要在pom.xml文件对应以下代码 <build> <finalName>ljl</finalName> //打包 ...

  3. Linux安装gitlab

    一.GitLab 是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的web服务.安装方法是参考GitLab在GitHub上的Wiki页面. 二.我相信使用过git的开 ...

  4. springboot入门之一:环境搭建

    springboot简介 springboot做为微服务的开发集合框架,有着天然的好处,它不像springmvc那样笨重繁杂,springmvc众多的配置使得开发人员很厌烦,为解决众多的配置带来的烦扰 ...

  5. Flask开发环境搭建

    基础准备 Python 3.6.5 Conda Visual Studio Code 虚拟环境 创建虚拟环境 conda create -n flask 激活虚拟环境 activate flask 关 ...

  6. VirtualBox复制CentOS后提示Device eth0 does not seem to be present的解决方法

    使用VirtualBox复制一份CentOS后重新设置了网卡地址,导致启动网络服务出现下图错误 解决方案 执行命令,查看/etc/udev/rules.d/70-persistent-net.rule ...

  7. Python中abs()和math.fabs()区别

    描述:Python中fabs(x)方法返回x的绝对值.虽然类似于abs()函数,但是两个函数之间存在以下差异: abs()是一个内置函数,而fabs()在math模块中定义的. fabs()函数只适用 ...

  8. POJ-3122(二分算法)

    //题意:这是一个分蛋糕的游戏, t个测试数据,输入n, f n代表的是n块蛋糕,蛋糕的高为1, f代表的是f个人朋友,然后输入每份蛋糕的半径 // 将n块蛋糕分成 f+1 份 每一份都是完成的一块蛋 ...

  9. 【转】lvs、nginx、haproxy转发模式优缺点总结

    原文地址: https://yq.aliyun.com/ziliao/78374 一.LVS转发模式 LVS是章文嵩博士写的一个工作于四层的高可能性软件.不像后两者支持七层转发,不过也正因为其简单,所 ...

  10. 422. Length of Last Word【LintCode java】

    Description Given a string s consists of upper/lower-case alphabets and empty space characters ' ', ...