全栈工程师开发手册 (作者:栾鹏)
架构系列文章
HBase Rest 是建立在HBase java 客户端基础之上的,提供的web 服务。它存在的目的是给开发者一个更多的选择。
1.启动rest 服务
(1)hbase rest start
用默认的方式启动rest服务,端口是8080。
(2)hbase rest start 8585
这种方式以端口8585方式启动。
(3)以daemon方式启动
hbase-daemon.sh start rest -p 8585
停止rest服务
hbase-daemon.sh stop rest
2.url
(1)查看表
http://hadoop0:8585/
(2)查看表的schema
http://hadoop0:8585/test/
(3)HBase操作对于的HTTP请求方式
Database Operations |
REST/HTTP Equivalents |
CREATE |
PUT |
READ |
GET |
UPDATE |
POST (update) or PUT (replace) |
DELETE |
DELETE |
数据的增删查改
get方式读取数据 cell or row
下面()内表示可有可无
path := '/' <table>
'/' <row>
( '/' ( <column> ( ':' <qualifier> )
( ',' <column> ( ':' <qualifier> ) )+ )
( '/' ( <start-timestamp> ',' ) <end-timestamp> ) )
query := ( '' 'v' '=' <num-versions> )
put方式存储数据
path := '/' <table> '/' <row> '/' <column> ( ':' <qualifier> )
( '/' <timestamp> )
put方式存储多个或一批数据
path := '/' <table> '/' <false-row-key>
DELETE方式删除指定行、指定列、或指定cell数据
path := '/' <table>
'/' <row>
( '/' <column> ( ':' <qualifier> )
( '/' <timestamp> ) )
表格或schema的增删查改
table creation or schema update(PUT or POST), schema query(GET), or delete (DELETE)
path := '/' <table> / 'schema'
scanner creation (POST)
path := '/' <table> '/' 'scanner'
scanner next item (GET)
path := '/' <table> '/' 'scanner' '/' <scanner-id>
scanner deletion (DELETE)
path := '/' <table> '/' '%scanner' '/' <scanner-id>
其他元信息查询
查询版本信息
/version
查询集群信息
/version/cluster
查询集群状态
/status/cluster
创建和更新表的schema
put /table/shcema
Post /table/schema
查询表元数据
get /table/resions
删除表
delete /table/schema
cell 查询
GET /<table>/<row>/<column> ( : <qualifier> )( / <timestamp> )
scan
put/post /table/scanner