hbase 的 coprocessor分为observer和endpoint两种方式,具体的区别和应用场景大概如下:
observer 类似于dbms的触发器,工作在服务器端,可以实现权限管理,监控,创建二级索引等
endpoint类似于存储过程,工作在服务器端和客户端,可以实现一些统计型的工作例如:max、min、total等计算
coprocessor 还分为系统级和表级的,系统级的coprocessor会作用于所有的table所有region,而表级的coprocessor只会作用于某个表的region
我们想为表创建一些二级索引表,并且想针对不同的表使用不同的策略。所以使用到了表级的observer的coprocessor。
observer coprocessor 又分为三类:RegionObserver,WALObserver和MasterObserver。
RegionObserver: Provides hooks for data manipulation events, Get, Put, Delete, Scan, and so on. There is an instance of a RegionObserver coprocessor
for every table region and the scope of the observations they can make is constrained to that region.
WALObserver: Provides hooks for write-ahead log (WAL) related operations. This is a way to observe or intercept WAL writing and reconstruction events. A WALObserver runs in the context of WAL processing. There is one such context per region server.
MasterObserver: Provides hooks for DDL-type operation, i.e., create, delete, modify table, etc. The MasterObserver runs within the context of the
HBase master.
<