Hadoop RPC Protocol description--Go

Source: Internet
Author: User

Original address: 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 is sent to setup a session. After this, multiple requests can be sent within the session.

Function Type Default
Header bytes "HRPC"
Version Uint8 7
Auth method Uint8 (Auth method Simple )
Serialization type Uint8 0 (protobuf)
Ipcconnectioncontextproto length UInt32
Ipcconnectioncontextproto bytes
Sending messages

When sending a message, the following are sent to the sever:

TR class= "row-odd" >
Function Type
Length of the next, parts uint32
Rpcpayloadheaderproto length< /td> 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 I Mplementation 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 ha S a property request This contains the serialized actual request message.

Receiving messages

After a message was sent, the response can be read in the following-the-type:

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 are 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--Go

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.