The implementation for endpoints in HBase 0.96.x

2015/01/04 17:13
阅读数 94

The implementation for endpoints changed significantly in HBase 0.96.x due to the introduction of protocol buffers (protobufs) (HBASE-5488). If you created endpoints before 0.96.x, you will need to rewrite them. Endpoints are now defined and callable as protobuf services, rather than endpoint invocations passed through as Writable blobs.

Dynamic RPC endpoints resemble stored procedures. An endpoint can be invoked at any time from the client. When it is invoked, it is executed remotely at the target region or regions, and results of the executions are returned to the client.

The endpoint implementation is installed on the server and is invoked using HBase RPC. The client library provides convenience methods for invoking these dynamic interfaces.

An endpoint, like an observer, can communicate with any installed observers. This allows you to plug new features into HBase without modifying or recompiling HBase itself.

Steps to Implement an Endpoint

  • Define the coprocessor service and related messages in a .proto file

  • Run the protoc command to generate the code.

  • Write code to implement the following:

  • The client calls the new HTable.coprocessorService() methods to perform the endpoint RPCs.

For more information and examples, refer to the API documentation for the coprocessor package, as well as the included RowCount example in the /hbase-examples/src/test/java/org/apache/hadoop/hbase/coprocessor/example/ of the HBase source.



0 收藏
0 评论
0 收藏