hbase java rest_HBase rest

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

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 Operations

REST/HTTP Equivalents

CREATE

PUT

READ

GET

UPDATE

POST (update) or PUT (replace)

DELETE

DELETE

Addressing for cell or row query (GET)

path := '/'

'/'

( '/' ( ( ':' )?

( ',' ( ':' )? )+ )?

( '/' ( ',' )? )? )?

query := ( '?' 'v' '=' )?

Addressing for single value store (PUT)

Address with table, row, column (and optional qualifier), and optional timestamp.

path := '/'

( '/' )?

Addressing for multiple (batched) value store (PUT)

path := '/'

Addressing for row, column, or cell DELETE

path := '/'

'/'

( '/' ( ':' )?

( '/' )? )?

Addressing for table creation or schema update (PUT or POST), schema query(GET), or delete (DELETE)

path := '/'

Addressing for scanner creation (POST)

path := '/'

Addressing for scanner next item (GET)

path := '/'

Addressing for scanner deletion (DELETE)

path := '/'

(4) 查询版本信息

http://hadoop0:8585/version

(5)查询集群信息

http://hadoop0:8585/version/cluster

(6)查询集群状态http://hadoop0:8585/status/cluster

(7)创建和更新表的schema

put /table/shcema

Post /table/schema

(8)查询表元数据

get /table/resions

(9)删除表

delete /table/schema

(10)cell 查询GET /

( : )?

( / )?(11)scan

put/post /table/scanner

返回的xml 结构

xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="StargateSchema">

type="tns:StorageClusterVersion">

type="tns:StorageClusterStatus">

maxOccurs="unbounded" minOccurs="0">

minOccurs="0">

返回的protobuf schemamessage Version {

optional string stargateVersion = 1;

optional string jvmVersion = 2;

optional string osVersion = 3;

optional string serverVersion = 4;

optional string jerseyVersion = 5;

}

message StorageClusterStatus {

message Region {

required bytes name = 1;

optional int32 stores = 2;

optional int32 storefiles = 3;

optional int32 storefileSizeMB = 4;

optional int32 memstoreSizeMB = 5;

optional int32 storefileIndexSizeMB = 6;

}

message Node {

required string name = 1; // name:port

optional int64 startCode = 2;

optional int32 requests = 3;

optional int32 heapSizeMB = 4;

optional int32 maxHeapSizeMB = 5;

repeated Region regions = 6;

}

// node status

repeated Node liveNodes = 1;

repeated string deadNodes = 2;

// summary statistics

optional int32 regions = 3;

optional int32 requests = 4;

optional double averageLoad = 5;

}

message TableList {

repeated string name = 1;

}

message TableInfo {

required string name = 1;

message Region {

required string name = 1;

optional bytes startKey = 2;

optional bytes endKey = 3;

optional int64 id = 4;

optional string location = 5;

}

repeated Region regions = 2;

}

message TableSchema {

optional string name = 1;

message Attribute {

required string name = 1;

required string value = 2;

}

repeated Attribute attrs = 2;

repeated ColumnSchema columns = 3;

// optional helpful encodings of commonly used attributes

optional bool inMemory = 4;

optional bool readOnly = 5;

}

message ColumnSchema {

optional string name = 1;

message Attribute {

required string name = 1;

required string value = 2;

}

repeated Attribute attrs = 2;

// optional helpful encodings of commonly used attributes

optional int32 ttl = 3;

optional int32 maxVersions = 4;

optional string compression = 5;

}

message Cell {

optional bytes row = 1; // unused if Cell is in a CellSet

optional bytes column = 2;

optional int64 timestamp = 3;

optional bytes data = 4;

}

message CellSet {

message Row {

required bytes key = 1;

repeated Cell values = 2;

}

repeated Row rows = 1;

}

message Scanner {

optional bytes startRow = 1;

optional bytes endRow = 2;

repeated bytes columns = 3;

optional int32 batch = 4;

optional int64 startTime = 5;

optional int64 endTime = 6;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值