The implementation for endpoints in HBase 0.96.x

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 generated protobuf Service interface

    • the new org.apache.hadoop.hbase.coprocessor.CoprocessorService interface (required for theRegionCoprocessorHost to register the exposed service) (注:通过表模式加载coprocessor的方式就可以了。)

  • 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.

你可能感兴趣的:(hbase,endpoints,protobufs,0.98.9)