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 ...
随机推荐
- 20155317 2016-2017-2 《Java程序设计》实验一 Java开发环境的熟悉
20155317 2016-2017-2 <Java程序设计>实验一 Java开发环境的熟悉 实验内容 使用JDK编译.运行简单的Java程序: 使用IDEA 编辑.编译.运行.调试Jav ...
- 20155319 2016-2017-2 《Java程序设计》第一周学习总结
20155319 2016-2007-2 <Java程序设计>第一周学习总结 考核方式 翻转课堂考核12次(5*12=60):每次考试20-30道题目,考试成绩规格化成5分(如总分20分就 ...
- 20145234黄斐《Java程序设计》实验一—Java开发环境的熟悉(Linux + Eclipse)
实验步骤 由于实验时间比较紧张,这里只有最终结果的截图 (一)命令行下Java程序开发 (二)Eclipse下Java程序开发.调试 (三)练习 实现求正整数1-N之间所有质数的功能,并进行测试 实验 ...
- removeAttribute与removeAttributeNode的区别
1.removeAttributeNode() 方法删除指定的属性,并以 Attr Node 对象返回被删除的属性. 例: <!DOCTYPE html><html><b ...
- 【JUC源码解析】ConcurrentHashMap
简介 支持并发的哈希表.其中包括红黑树,扩容,分槽计数等知识点. 源码分析 常量 private static final int MAXIMUM_CAPACITY = 1 << 30; ...
- Git生成多个ssh key
在实际的工作中, 有可能需要连接多个远程仓库, 例如我想连接私有仓库.GitLab官网.GitHub官网, 那么同一台电脑就要生成多个ssh key: ssh-keygen -t rsa -C &qu ...
- selenium +java 多个类公用driver问题
问题点:太久没有写selenium代码,居然把driver公用的问题忘记了,即:每写一个测试类,执行过程中都会新建一个窗口,这样应该说是非常不专业的. 大概想了一个方法,虽然看起来也不怎么专业,但感觉 ...
- selenium+Java,xpath定位方法详解(搬运留存)
用xpath绝对路径比较费事费力,还容易报错,下面几种模糊定位比较灵活好用 driver.findElement(By.xpath("//*[@id='J_login_form']/dl/d ...
- 【SpringCloud】第十二篇: 断路器监控(Hystrix Turbine)
前言: 必需学会SpringBoot基础知识 简介: spring cloud 为开发人员提供了快速构建分布式系统的一些工具,包括配置管理.服务发现.断路器.路由.微代理.事件总线.全局锁.决策竞选. ...
- Power Designer逆向工程导入Oracle表,转为模型加注释
1.打开PowerDesigner ——文件——Reverse Engineer——DataBase 2.选择所要连接数据库版本,此处使用的是oracle version 11g. 3.点击红色区域, ...