HBase intra row scanning
By Lars Hofhansl Updated (again) Wednesday, January 25th, 2012. As I painfully worked through HBASE-5229 I realized that HBase already has all the building blocks needed for complex (local) transactions. What's important here is that (see
By Lars HofhanslUpdated (again) Wednesday, January 25th, 2012.
As I painfully worked through HBASE-5229 I realized that HBase already has all the building blocks needed for complex (local) transactions.
What's important here is that (see my introduction to HBase):
- HBase ensures atomicity for operations for the same row key
- HBase keys have internal structure: (row-key, column family, column, ...)
// all columns whose identifier starts with "abc"
Filter f = new ColumnRangeFilter(Bytes.toBytes("abc"), true,
Bytes.toBytes("abd"), false);
// all columns whose identifier sorts after "test"
Filter f = new ColumnRangeFilter(Bytes.toBytes("test"), true,
null, true);
So this allows to search (scan) inside a row by column identifier just as HBase allows searching by row key.
A client application can exploit this to achieve transactions by grouping all entities that can participate in the same transaction into a single row (and single column family).
Then using prefixes of the column identifiers can be used to define rows inside that group. Basically the search criteria for keys was moved one level down to the column identifier.
Say we wanted to implement a store with transactional tables that contain rows and columns. One way to doing this with HBase as follows:
- the HBase row-key/column-family maps to a "table"
- a prefix of the HBase column identifier maps to a "row"
- the rest of the HBase column identifier identifies the "column"
This leads to potentially wide HBase rows with many columns. The missing piece is allowing a Scan to efficiently retrieve a slice of a wide row.
This where ColumnRangeFilter comes into play. This filter seeks efficiently into the row by seeking ahead to the first HBase block that contains the first KeyValue (or cell) for that column.
Let's model a table "pets" this way. And let's say a pet has a name and a species. The HBase key for entries would look like this:
(table, CF1, rowA|column1) -> value for column1 in rowA
The code would look something like this:
(apologies for the initial incorrect code that I had posted here)
HTable t = ...;
Scan s = ...;
s.setStartRow("pets");
s.setStopRow("pets");
// get all columns for my pet "fluffy".
Filter f = new ColumnRangeFilter(Bytes.toBytes("fluffy"), true,
Bytes.toBytes("fluffz"), false);
s.setFilter(f);
s.setBatch(20); // avoid getting all columns for the HBase row
ResultScanner rs = t.getScanner(s);
for (Result r = rs.next(); r != null; r = rs.next()) {
// r will now have all HBase columns that start with "fluffy",
// which would represent a single rowfor (KeyValue kv : r.raw()) {
// each kv represent - the latest version of - a column
}
}
The downside of this is that HBase achieves atomicity by collocating all cells with the same row-key, so it has to be hosted by a single region server.
原文地址:HBase intra row scanning, 感谢原作者分享。

ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

AI Hentai Generator
AIヘンタイを無料で生成します。

人気の記事

ホットツール

メモ帳++7.3.1
使いやすく無料のコードエディター

SublimeText3 中国語版
中国語版、とても使いやすい

ゼンドスタジオ 13.0.1
強力な PHP 統合開発環境

ドリームウィーバー CS6
ビジュアル Web 開発ツール

SublimeText3 Mac版
神レベルのコード編集ソフト(SublimeText3)

ホットトピック









ビッグデータ時代の到来に伴い、データの処理と保存の重要性がますます高まっており、大量のデータをいかに効率的に管理、分析するかが企業にとっての課題となっています。 Apache Foundation の 2 つのプロジェクトである Hadoop と HBase は、ビッグ データのストレージと分析のためのソリューションを提供します。この記事では、ビッグデータのストレージとクエリのために Beego で Hadoop と HBase を使用する方法を紹介します。 1. Hadoop と HBase の概要 Hadoop は、オープンソースの分散ストレージおよびコンピューティング システムです。

依存関係: org.springframework.dataspring-data-hadoop-hbase2.5.0.RELEASEorg.apache.hbasehbase-client1.1.2org.springframework.dataspring-data-hadoop2.5.0.RELEASE 構成を追加する正式な方法は、xml を使用することです。 simple 書き換えると以下のようになります。 @ConfigurationpublicclassHBaseConfiguration{@Value("${hbase.zooke

Java を使用して HBase に基づいた NoSQL データベース アプリケーションを開発する方法 はじめに: ビッグ データ時代の到来により、NoSQL データベースは大量のデータを処理するための重要なツールの 1 つになりました。 HBase は、オープンソースの分散型 NoSQL データベース システムとして、ビッグ データの分野で広範なアプリケーションを備えています。この記事では、Java を使用して HBase に基づく NoSQL データベース アプリケーションを開発する方法を紹介し、具体的なコード例を示します。 1. HBase の概要: HBase は、Hadoop に基づく分散システムです。

ビッグデータ時代の到来により、大量のデータの保存と処理が特に重要になっています。 NoSQL データベースに関しては、HBase が現在広く使用されているソリューションです。 Go 言語は、静的に強く型付けされたプログラミング言語であり、そのシンプルな構文と優れたパフォーマンスにより、クラウド コンピューティング、Web サイト開発、データ サイエンスなどの分野で使用されることが増えています。この記事では、Go 言語で HBase を使用して効率的な NoSQL データベース アプリケーションを実装する方法を紹介します。 HBase の概要 HBase は、拡張性が高く、信頼性が高く、基本的な

インターネット アプリケーションとデータ量の継続的な増加に伴い、従来のリレーショナル データベースでは、大量のデータの保存と処理のニーズを満たすことができなくなりました。新しいタイプのデータベース管理システムとして、NoSQL (NotOnlySQL) は大規模なデータの保存と処理において大きな利点があり、ますます注目され、応用されています。 NoSQL データベースの中でも、ApacheHBase は非常に人気のあるオープンソースの分散データベースであり、Google の BigTable のアイデアに基づいて設計されており、

Beego フレームワークでのデータ ストレージとクエリに HBase を使用する インターネット時代の継続的な発展に伴い、データ ストレージとクエリはますます重要になってきています。ビッグデータ時代の到来により、さまざまなデータソースがそれぞれの分野で重要な位置を占めていますが、非リレーショナルデータベースはデータストレージとクエリに明らかな利点を備えたデータベースであり、HBaseはHadoopをベースとした分散型非リレーショナルデータベースです。リレーショナル データベース。この記事では、Beego フレームワークでのデータ ストレージとクエリに HBase を使用する方法を紹介します。 1.H

Workerman は、多数の同時接続をホストできる高性能 PHPsocket フレームワークです。従来の PHP フレームワークとは異なり、Workerman は Apache や Nginx などの Web サーバーに依存せず、PHP プロセスを開始することでアプリケーション全体を単独で実行します。 Workerman は非常に高い作業効率と優れた耐荷重性を備えています。同時に、HBase はビッグデータで広く使用されている分散型 NoSQL データベース システムです。

HBase は、大規模な構造化データを保存および処理するために設計された Hadoop ベースの分散ストレージ システムです。読み取りおよび書き込みのパフォーマンスを最適化するために、HBase はさまざまなキャッシュ メカニズムを提供します。これにより、クエリ効率が向上し、適切な構成を通じて読み取りおよび書き込みの遅延が軽減されます。この記事では、HBase キャッシュ テクノロジとその構成方法を紹介します。 HBase のキャッシュ タイプ HBase は、ブロック キャッシュ (BlockCache) と MemStore キャッシュ (書き込みキャッシュとも呼ばれます) という 2 つの基本的なキャッシュ メカニズムを提供します。ブロックキャッシュは次のとおりです
