hbase使用restful接口进行数据操作

全栈工程师开发手册 (作者:栾鹏)
架构系列文章


HBase Rest 是建立在HBase java 客户端基础之上的,提供的web 服务。它存在的目的是给开发者一个更多的选择。

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-RIWnRZp4-1606048235205)(http://blog.cloudera.com/wp-content/uploads/2013/03/jesse1.png)]

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 OperationsREST/HTTP Equivalents
CREATEPUT
READGET
UPDATEPOST (update) or PUT (replace)
DELETEDELETE

数据的增删查改

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 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值