- 921. Minimum Add to Make Parentheses Valid 使括号有效的最少添加
- 915. Partition Array into Disjoint Intervals 分割数组
- 932. Beautiful Array 漂亮数组
- 940. Distinct Subsequences II 不同的子序列 II
REST代表状态转移,它于2000年在Roy Fielding的博士论文中引入,他是HTTP规范的主要作者之一。
REST本身超出了本文档的范围,但通常,REST允许通过与URL本身绑定的API进行客户端-服务器交互。本节讨论如何配置和运行HBase附带的REST服务器,该服务器将HBase表,行,单元和元数据作为URL指定的资源公开。
包含的REST服务器可以作为守护程序运行,该守护程序启动嵌入式Jetty servlet容器并将servlet部署到其中。使用以下命令之一在前台或后台启动REST服务器。端口是可选的,默认为8080。
# Foreground
$ bin/hbase rest start -p <port>
# Background, logging to a file in $HBASE_LOGS_DIR
$ bin/hbase-daemon.sh start rest -p <port>
要停止REST服务器,请在前台运行时使用Ctrl-C,如果在后台运行则使用以下命令。
$ bin/hbase-daemon.sh stop rest
有关为SSL配置REST服务器和客户端以及为REST服务器配置doAs模拟的信息,请参阅配置Thrift网关以代表客户端进行身份验证以及Securing Apache HBase章节的其他部分。
以下示例使用占位符服务器http://example.com:8000,并且可以使用curl或wget命令运行以下命令。您可以通过不为纯文本添加头信息来请求纯文本(默认),XML或JSON输出,或者为XML添加头信息“Accept:text / xml”,为JSON添加“Accept:application / json”或为协议缓冲区添加“Accept: application/x-protobuf”。
除非指定,否则使用GET请求进行查询,PUT或POST请求进行创建或修改,DELETE用于删除。
群集范围的端点
“\
"Accept: text/xml" \\
“\
“\
"Accept: text/xml" \\
“\
“\
"Accept: text/xml" \\
“\
端点 | HTTP动词 | 描述 | 示例 |
---|---|---|---|
/version/cluster |
GET |
在此群集上运行的HBase版本 |
|
/status/cluster |
GET |
群集状态 |
|
/ |
GET |
所有非系统表的列表 |
命名空间端点
“\
"Accept: text/xml" \\
“\
“\
"Accept: text/xml" \\
“\
“\
"Accept: text/xml" \\
“\
“\
"Accept: text/xml" \\
“\
“\
"Accept: text/xml" \\
“\
“\
"Accept: text/xml" \\
“\
端点 | HTTP动词 | 描述 | 示例 |
---|---|---|---|
/namespaces |
GET |
列出所有命名空间 |
|
/namespaces/namespace |
GET |
描述特定的命名空间 |
|
/namespaces/namespace |
POST |
创建一个新的命名空间 |
|
/namespaces/namespace/tables |
GET |
列出特定命名空间中的所有表 |
|
/namespaces/namespace |
PUT |
更改现有命名空间。目前尚未使用 |
|
/namespaces/namespace |
DELETE |
删除命名空间。命名空间必须为空 |
表端点
“\
"Accept: text/xml" \\
“\
“\
"Accept: text/xml" \\
"Content-Type: text/xml" \\
'`<?xml version="1.0" encoding="UTF-8"?>`<TableSchema name="users">`<ColumnSchema name="cf" KEEP\_DELETED\_CELLS="true" />`</TableSchema>`' \\
“\
“\
"Accept: text/xml" \\
"Content-Type: text/xml" \\
'`<?xml version="1.0" encoding="UTF-8"?>`<TableSchema name="users">`<ColumnSchema name="cf" />`</TableSchema>`' \\
“\
“\
"Accept: text/xml" \\
“\
“\
"Accept: text/xml" \\
“\
端点 | HTTP动词 | 描述 | 示例 |
---|---|---|---|
/table/schema |
GET |
描述指定表的架构 |
|
/table/schema |
POST |
使用提供的架构片段更新现有表 |
|
/table/schema |
PUT |
创建新表,或替换现有表的架构 |
|
/table/schema |
DELETE |
删除表格。您必须使用端点/table/schema/,而不仅仅是table/ | |
/table/regions |
GET |
列出表区域 |
Get操作的端点
“\
"Accept: text/xml" \\
“\
“\
"Accept: text/xml" \\
“\
“\
"Accept: text/xml" \\
ttp://example.com:8000/users/row1/cf:a"
\-vi -X GET \\
"Accept: text/xml" \\
“\
“\
"Accept: text/xml" \\
“\
端点 | HTTP动词 | 描述 | 示例 |
---|---|---|---|
/table/row |
GET |
获取单行的所有列。值为Base-64编码。这需要“Accept”请求标头,其类型可以包含多个列(如xml,json或protobuf)。 | |
/table/row/column:qualifier/timestamp |
GET |
获取单个列的值。值为Base-64编码。 |
|
/table/row/column:qualifier |
GET |
获取单个列的值。值为Base-64编码。 |
|
/table/row/column:qualifier/?v=number_of_versions |
GET |
Multi-获取给定单元格的指定数量的版本。值为Base-64编码。 |
Scan操作的端点
“\
"Accept: text/xml" \\
"Content-Type: text/xml" \\
'`<Scanner batch="1"/>`' \\
“\
“\
"Accept: text/xml" \\
"Content-Type:text/xml" \\
@filter.txt \\
“\
“\
"Accept: text/xml" \\
“\
“\
"Accept: text/xml" \\
“\
端点 | HTTP动词 | 描述 | 示例 |
---|---|---|---|
/table/scanner/ |
PUT |
获取Scanner对象。所有其他扫描操作都需要。将批处理参数调整为扫描应在批处理中返回的行数。请参阅下一个向扫描仪添加过滤器的示例。扫描程序端点URL将作为HTTP响应中的Location返回。此表中的其他示例假定扫描程序端点为:http://example.com:8000/users/scanner/145869072824375522207。 |
|
/table/scanner/ |
PUT |
要向扫描仪对象提供过滤器或以任何其他方式配置扫描仪,您可以创建文本文件并将过滤器添加到文件中。例如,要仅返回以<codeph> u123 </ codeph>开头并使用批量大小为100的行,过滤器文件将如下所示: [source,xml] —- <Scanner batch =“100”> <filter> {“type”:“PrefixFilter”,“value”:“u123”} </ filter> </ Scanner> —- 将文件传递给curl请求的-d参数。 |
|
/table/scanner/scanner-id |
GET |
从扫描仪获取下一批。单元格值是字节编码的。如果扫描仪已耗尽,则返回HTTP状态204。 |
|
table/scanner/scanner-id |
DELETE |
删除扫描仪并释放它使用的资源。 |
Put操作的端点
“\
"Accept: text/xml" \\
"Content-Type: text/xml" \\
'`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>`<CellSet>`<Row key="cm93NQo=">`<Cell column="Y2Y6ZQo=">`dmFsdWU1Cg==`</Cell>`</Row>`</CellSet>`' \\
ttp://example.com:8000/users/fakerow"
\-vi -X PUT \\
"Accept: text/json" \\
"Content-Type: text/json" \\
'\{"Row":\[\{"key":"cm93NQo=", "Cell": \[\{"column":"Y2Y6ZQo=", " `$` ":"dmFsdWU1Cg=="\}\]\}\]\}'' \\
“\
端点 | HTTP动词 | 描述 | 示例 |
---|---|---|---|
/table/row_key |
PUT |
在表中写一行。行、列限定符和值必须均为Base-64编码。要对字符串进行编码,请使用base64命令行实用程序。要解码字符串,请使用base64 -d。有效负载位于–data参数中,/users/fakerow值为占位符。通过将多行添加到<CellSet>元素中来插入多行。您还可以将要插入的数据保存到文件中,并使用-d @filename.txt语法将其传递给参数-d。 |
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="RESTSchema">
<element name="Version" type="tns:Version"></element>
<complexType name="Version">
<attribute name="REST" type="string"></attribute>
<attribute name="JVM" type="string"></attribute>
<attribute name="OS" type="string"></attribute>
<attribute name="Server" type="string"></attribute>
<attribute name="Jersey" type="string"></attribute>
</complexType>
<element name="TableList" type="tns:TableList"></element>
<complexType name="TableList">
<sequence>
<element name="table" type="tns:Table" maxOccurs="unbounded" minOccurs="1"></element>
</sequence>
</complexType>
<complexType name="Table">
<sequence>
<element name="name" type="string"></element>
</sequence>
</complexType>
<element name="TableInfo" type="tns:TableInfo"></element>
<complexType name="TableInfo">
<sequence>
<element name="region" type="tns:TableRegion" maxOccurs="unbounded" minOccurs="1"></element>
</sequence>
<attribute name="name" type="string"></attribute>
</complexType>
<complexType name="TableRegion">
<attribute name="name" type="string"></attribute>
<attribute name="id" type="int"></attribute>
<attribute name="startKey" type="base64Binary"></attribute>
<attribute name="endKey" type="base64Binary"></attribute>
<attribute name="location" type="string"></attribute>
</complexType>
<element name="TableSchema" type="tns:TableSchema"></element>
<complexType name="TableSchema">
<sequence>
<element name="column" type="tns:ColumnSchema" maxOccurs="unbounded" minOccurs="1"></element>
</sequence>
<attribute name="name" type="string"></attribute>
<anyAttribute></anyAttribute>
</complexType>
<complexType name="ColumnSchema">
<attribute name="name" type="string"></attribute>
<anyAttribute></anyAttribute>
</complexType>
<element name="CellSet" type="tns:CellSet"></element>
<complexType name="CellSet">
<sequence>
<element name="row" type="tns:Row" maxOccurs="unbounded" minOccurs="1"></element>
</sequence>
</complexType>
<element name="Row" type="tns:Row"></element>
<complexType name="Row">
<sequence>
<element name="key" type="base64Binary"></element>
<element name="cell" type="tns:Cell" maxOccurs="unbounded" minOccurs="1"></element>
</sequence>
</complexType>
<element name="Cell" type="tns:Cell"></element>
<complexType name="Cell">
<sequence>
<element name="value" maxOccurs="1" minOccurs="1">
<simpleType><restriction base="base64Binary">
</simpleType>
</element>
</sequence>
<attribute name="column" type="base64Binary" />
<attribute name="timestamp" type="int" />
</complexType>
<element name="Scanner" type="tns:Scanner"></element>
<complexType name="Scanner">
<sequence>
<element name="column" type="base64Binary" minOccurs="0" maxOccurs="unbounded"></element>
</sequence>
<sequence>
<element name="filter" type="string" minOccurs="0" maxOccurs="1"></element>
</sequence>
<attribute name="startRow" type="base64Binary"></attribute>
<attribute name="endRow" type="base64Binary"></attribute>
<attribute name="batch" type="int"></attribute>
<attribute name="startTime" type="int"></attribute>
<attribute name="endTime" type="int"></attribute>
</complexType>
<element name="StorageClusterVersion" type="tns:StorageClusterVersion" />
<complexType name="StorageClusterVersion">
<attribute name="version" type="string"></attribute>
</complexType>
<element name="StorageClusterStatus"
type="tns:StorageClusterStatus">
</element>
<complexType name="StorageClusterStatus">
<sequence>
<element name="liveNode" type="tns:Node"
maxOccurs="unbounded" minOccurs="0">
</element>
<element name="deadNode" type="string" maxOccurs="unbounded"
minOccurs="0">
</element>
</sequence>
<attribute name="regions" type="int"></attribute>
<attribute name="requests" type="int"></attribute>
<attribute name="averageLoad" type="float"></attribute>
</complexType>
<complexType name="Node">
<sequence>
<element name="region" type="tns:Region"
maxOccurs="unbounded" minOccurs="0">
</element>
</sequence>
<attribute name="name" type="string"></attribute>
<attribute name="startCode" type="int"></attribute>
<attribute name="requests" type="int"></attribute>
<attribute name="heapSizeMB" type="int"></attribute>
<attribute name="maxHeapSizeMB" type="int"></attribute>
</complexType>
<complexType name="Region">
<attribute name="name" type="base64Binary"></attribute>
<attribute name="stores" type="int"></attribute>
<attribute name="storefiles" type="int"></attribute>
<attribute name="storefileSizeMB" type="int"></attribute>
<attribute name="memstoreSizeMB" type="int"></attribute>
<attribute name="storefileIndexSizeMB" type="int"></attribute>
</complexType>
</schema>
message Version {
optional string restVersion = 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;
}
发出时Delete对于 hbase,我知道它不会立即删除数据。但是什么时候删除数据,我的意思是,物理上? 最佳答案 当您向 HBase 写入内容时,它会存储在内存存储 (RAM) 中,然后再写入磁盘。
同一行的列族属于同一个 RegionServer。 那么,这里的问题是一个 RegionServer 会在不同的机器上存储不同的列族吗? 最佳答案 不一定,但在某些时候它会。这是基本 HBase 架构
如果我想插入表格: row | fam:qualifier | timestamp | value 1 | foo:bar | 12345 | 2 1 | foo:bar | 12346 | 3 1
有时我想退出我在 HBase shell 中运行的命令,例如扫描操作通常需要太多时间。 所以我想停止运行这个命令,但我不想退出 HBase shell。 我常用的停止运行命令的方式,我使用了Ctrl+
有没有办法设置 Hbase 以便我们可以在同一个集群中创建多个数据库? 最佳答案 只是为了刷新主题:http://hbase.apache.org/book.html#namespace 5.3.1.
怎么看version的 hbase我在用? 你能下命令吗? 最佳答案 hbase version命令行界面中的命令给出了 version的 hbase正在使用中。 以下是来自 Cloudera 的两个
高级问题: HBase 是否对所有分布(因此不是实现的工件)通用的每行施加了最大大小,无论是在 方面吗?字节存储 或在 方面细胞数 ? 如果是这样: 限制是什么? 极限存在的原因是什么? 限制在哪里记
假设,假设我在数据仓库设置中有一个星型模式。 有一个非常非常长的事实表(想想几十亿到几万亿行)和几个低基数维度表(想想 100 个维度表)。每个事实表外键 指向一个维度表的主键是位图索引的。每个维度表
版本:Hadoop: 2.0.0-cdh4.3.1 HBase: 0.94.6-cdh4.3.1 我正在运行 cloudera quick start vm,这是我的小型远程 HBase Java 客
我正在尝试以完全分布式模式配置 HBase。 (使用 Ubuntu 12.04,Apache Hadoop 2.2(以伪模式运行,HBase 版本 0.98) 以下是我的 bashrc 设置: exp
我想知道如何正确配置 hbase.zookeeper.quorum 以将 zookeeper 实例指向集群模式。 最佳答案 hbase.zookeeper.quorum 属性是运行 ZooKeeper
我想知道如何正确配置 hbase.zookeeper.quorum 以将 zookeeper 实例指向集群模式。 最佳答案 hbase.zookeeper.quorum 属性是运行 ZooKeeper
我正在尝试对位于 Hbase 中的两个表进行映射连接。我的目的是在hashmap中保留小表的记录并与大表进行比较,一旦匹配,再次将记录写入hbase中的表中。我使用 Mapper 和 Reducer
我正在尝试编写一个程序来连接到 HBase。但是当我执行以下命令时HBaseConfiguration.create();我收到以下错误:. "hbase-default.xml 文件似乎是旧版本的
基于HBase documentation ,再次遵循 Google BigTable 论文的引用,据说这些行是按行键的字典顺序存储的。 很明显,当我们在 rowkey 中有一个字符串或者如果我们将一
我有一个 hbase 表,其中的行键如 row1、row2、row3 .... 和 rowN,我想要的是获取行键从 row100 到 row200 的行,如何编写查询子句或将 hbase 表设计为让查
我正在尝试创建命名空间,但出现类似下面给出的错误 hbase(main):031:0> create namespace 'Aniruddha'
我发现为以下要求建模 HBase 表有困难。 我有一个表“商店”,它存储了商店的详细信息(必胜客)。 我有一个表格“订单”,其中包含交易摘要(总交易金额等...)。 我有另一个表“Order_Item
谁能告诉我如果在不首先禁用表的情况下使用“alter”命令可能影响表结构的可能影响? 据我所知,禁用表意味着关闭与表的所有连接。如果我在不禁用表的情况下使用 alter,可能会发生什么异常情况? 我正
我无法将表从 HBase 导出到 HDFS。下面是错误跟踪。它是相当大的尺寸。还有其他方法可以导出吗? 我使用以下命令导出。我增加了 rpc 超时,但工作仍然失败。 sudo -u hdfs hbas
我是一名优秀的程序员,十分优秀!