First, to see Observercoprocessor:
1. The static load configuration of the observer coprocessor is configured in Hbase-site.xml with the following properties:
Configure Regionobservers and endpoints with hbase.coprocessor.region.classes.
Configure Walobservers with hbase.coprocessor.wal.classes.
Configure Masterobservers with hbase.coprocessor.master.classes.
Hbase.coprocessor.region.classes: Will be loaded on all the default tables.
Hbase.coprocessor.master.classes: Loaded by the hmaster process.
The corresponding Java classes are: Hmaster, hregion, Fshlog
2.HMaster
There is a property called Mastercoprocessorhost Cphost in Hmaster;
And a description of the Mastercoprocessorhost class:
Provides a coprocessor framework and environment for host-oriented operations. @link Hmaster interacts with the loaded coprocessor through this class.
Basemasterobserver implementation of MASTEROBSERVER, our custom observer coprocessor implements Basemasterobserver. In this class, there are all the methods in the Masterobserver, and finally the corresponding method is called.
Like what:
When a table is created, it is called in the Createtablehandler class:
3.HRegion
There is also a property called Private Regioncoprocessorhost coprocessorhost;
Description information for the Regioncoprocessorhost class:
Implements the coprocessor environment and runtime support that is loaded within the @link zone.
Called in the law of the Parties:
Call the hook function in Hregion:
3. Fshlog
The attributes in Fshlog are: walcoprocessorhost, which acts like the top two.
invocation Example
The Append method in the Fshlog class calls the coprocessor's hook function:
Second, endpoint co-processor
Dynamic RPC endpoints are similar to stored procedures. The terminal can be called from the client at any time. When invoked, it is executed remotely in the target region or zone, and the execution results are returned to the client.
Endpoint coprocessor-The dynamic RPC protocol, which computes directly in region, writes the client code call service and returns the result to the client (reponse).