disable 'users'
alter 'users', METHOD => 'table_att', 'coprocessor'=>'file:///home/u/mylib/UsersObserver.jar|test.hbase.inaction.example5_2.UsersObserver|1001|'
alter 'users', METHOD => 'table_att_unset',NAME => 'coprocessor$2'
删除
enable 'users'
hbase(main):022:0> scan 'users'
ROW COLUMN+CELL
id01 column=info:email, timestamp=1413963413002, value=wyj@gmail.com
id01 column=info:name, timestamp=1413963413002, value=wyj
id01 column=info:password, timestamp=1413963413002, value=000000
id01 column=info:user, timestamp=1413963413002, value=id01
id09 column=info:email, timestamp=1414566775616, value=test9@gmail.com
id09 column=info:name, timestamp=1414566775616, value=test9
id09 column=info:password, timestamp=1414566775616, value=9
id09 column=info:user, timestamp=1414566775616, value=id09
id99 column=info:email, timestamp=1414565339530, value=test99@gmail.com
id99 column=info:name, timestamp=1414565339530, value=test99
id99 column=info:password, timestamp=1414565339530, value======01=====
id99 column=info:user, timestamp=1414565339530, value=id99
invalID column=info:invalid_pass, timestamp=1414566775657, value=invalid_pass:9
11 row(s) in 0.1290 seconds
start() 和stop()这两个方法,在表enable和disable时分别也会对应履行
这start()和stop()在连接池里取得连接与释放连接实在是过剩
observer类似触发器,操作1张表的时候要注意递归调用,拦截到1次put后再put这个表就会递归
这个例子就是这样的,实际上没任何意义,就是个例子而已
注意锁,HBase是行级的锁,如果想put同1行是不会成功的
observer很不好调试,只能整1堆的log......